ngx_otel_module
ã¢ã¸ã¥ã¼ã« ã使ã㨠Nginx ã®ãã¬ã¡ããªã¼ãã¼ã¿ãåå¾ã§ãã¾ãã
otel_span_attr
ãã£ã¬ã¯ãã£ãã使ã£ã¦ Nginx ã®å¤æ°ãã¹ãã³å±æ§ã«è¿½å ããåå¾ããæ¹æ³ãç´¹ä»ãã¾ãã
ãã¢
以ä¸ã«ç´¹ä»ããå 容ã使ã£ããã¢ãä½ãã¾ãããDocker Compose ã§ç°¡åã«èµ·åã§ããã®ã§ããã²è©¦ãã¦ã¿ã¦ãã ããã
åå¾ããã¹ãã³å±æ§
ngx_otel_module
ã¢ã¸ã¥ã¼ã«ã¯ããã©ã«ãã§æ¬¡ã®ã¹ãã³å±æ§ãåå¾ãã¾ãã
http.method
http.target
http.route
http.scheme
http.flavor
http.user_agent
http.request_content_length
http.response_content_length
http.status_code
net.host.name
net.host.port
net.sock.peer.addr
net.sock.peer.port
ä¸è¨ã«å ãã¦ããã®è¨äºã§ã¯æ¬¡ã®ã¹ãã³å±æ§ãåå¾ãã¦ã¿ããã¨æãã¾ãã
http.request
http.request_time
otel_span_attr
ãã£ã¬ã¯ãã£ã
ngx_otel_module
ã¢ã¸ã¥ã¼ã«ã§ã¯ã otel_span_attr
ãã£ã¬ã¯ãã£ãã§ã¹ãã³å±æ§ã追å ã§ãã¾ãã
otel_span_attr name value;
åè: https://nginx.org/en/docs/ngx_otel_module.html#otel_span_attr
å¤æ° $request
ãã http.request
å±æ§ãä½æ
$request
ã¯ãªã¯ã¨ã¹ãå
¨ä½ (ã¡ã½ããã»ãã¹ã»ã¯ã¨ãªã»ãã©ã°ã¡ã³ãã»ãããã³ã«) ãæ ¼ç´ãã ngx_http_core_module
ã®åãè¾¼ã¿å¤æ°ã§ããä¾ãã°ãGET /favicon.ico HTTP/1.1
ã®ãããªå¤ãåå¾ã§ãã¾ãã
ããã©ã«ãã®å±æ§ãåèã«ã㦠http
ã¨ããåå空éãä»ãã¾ããã
otel_span_attr http.request $request;
å¤æ° $request_time
ãã http.request_time
å±æ§ãä½æ
$request_time
ã¯ãªã¯ã¨ã¹ãã®å¦çæé (ããªç§) ãæ ¼ç´ãã ngx_http_core_module
ã®åãè¾¼ã¿å¤æ°ã§ãã
http.request
ã¨åãããã« http
ãåå空éã¨ãã¾ãã
otel_span_attr http.request_time $request_time;
ãããã otel_span_attr
ãã£ã¬ã¯ãã£ãã使ã£ã¦åå¾ããå¤ã¯æåå (string) åã«ãªãã¾ããå¤æ° $request_time
ã¯å°æ°ã§ãããOpenTelemetry ã§ãå°æ°ã¨ãã¦æ±ãããã§ãã
http.request_time
å±æ§ãæåååããå精度浮åå°æ°ç¹æ°åã«å¤æãã
OpenTelemetry ã§ã¯å°æ°ã表ãåã¨ãã¦å精度浮åå°æ°ç¹æ° (double-precision floating-point) åãããã¾ããããã§ãhttp.request_time
å±æ§ã®å¤ãå精度浮åå°æ°ç¹æ°åã«å¤æãã¾ãã
Attributes Processor ã§åå¤æ
æå®ããå±æ§ã®åãå¤æã§ãã Attriutes Processor ã¨ãã Processor ãããã¾ãã
ãã® Processor ã使ã㨠OpenTelemetry ã® config ã¯æ¬¡ã®ããã«ãªãã¾ãã
... processors: batch: attributes: actions: - key: http.request_time action: convert converted_type: double ... service: pipelines: traces: receivers: [otlp] processors: [batch, attributes] exporters: [otlp]
çµæ
http.request
㨠http.request_time
ãéãã¾ããã
ã¾ã¨ã
Nginx ã®ãã¬ã¡ããªã¼ãã¼ã¿ã«ä»»æã®ã¹ãã³å±æ§ã追å ãã¦åå¾ããæ¹æ³ãç´¹ä»ãã¾ãããã¾ãããã®ã¨ãã«èª²é¡ã¨ãªãåå¤æã Attributes Processor ã§è¡ãæ¹æ³ãç´¹ä»ãã¾ããã