Closed alquerci closed 2 months ago
The attributes are applied from the final location of the request. Looks like, try_files
redirects your request to the regexp location, which doesn't have any otel_span_attr
directives.
Hello @p-pautov and thanks for the fast reply.
Let's try another alternative then
load_module modules/ngx_otel_module.so;
http {
otel_exporter {
endpoint "collector:4317";
}
server {
location / {
try_files $uri /index.php/$request_uri;
}
location ~ ^/index\.php(/|$) {
otel_trace on;
otel_trace_context propagate;
otel_span_attr deployment.environment.name "dev";
fastcgi_pass php:9000;
}
}
}
No trace sent.
That's because the sampling/propagation decision is made in the initial request location. We have #55 dedicated to this.
Documentation used
https://nginx.org/en/docs/ngx_otel_module.html#otel_span_attr
Environment
Include the result of the following commands:
docker run --rm nginx:1.27.1-alpine3.20-otel nginx -V
docker run --rm nginx:1.27.1-alpine3.20-otel uname -a
Description
otel_span_attr
directive is used inlocation
directive is same as ifotel_span_attr
directive is used inserver
directive.nginx configuration
or share the configuration in gist.
nginx debug log
It is advised to enable debug logging.
or share the debug log in gist.
Workaround
Move
location
directives onserver
.Initially posted https://github.com/nginx/nginx/issues/195