Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ngx_otel_module] otel_span_attr directive does not work on location directive #195

Open
2 tasks done
alquerci opened this issue Sep 18, 2024 · 1 comment
Open
2 tasks done
Labels

Comments

@alquerci
Copy link

alquerci commented Sep 18, 2024

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
nginx version: nginx/1.27.1
built by gcc 13.2.1 20240309 (Alpine 13.2.1_git20240309) 
built with OpenSSL 3.3.0 9 Apr 2024 (running with OpenSSL 3.3.2 3 Sep 2024)
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --with-perl_modules_path=/usr/lib/perl5/vendor_perl --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_v3_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-Os -fstack-clash-protection -Wformat -Werror=format-security -fno-plt -g' --with-ld-opt='-Wl,--as-needed,-O1,--sort-common -Wl,-z,pack-relative-relocs'
  • docker run --rm nginx:1.27.1-alpine3.20-otel uname -a
Linux c9a1f0f6ef66 5.15.0-122-generic #132~20.04.1-Ubuntu SMP Fri Aug 30 15:50:07 UTC 2024 x86_64 Linux

Description

otel_span_attr directive is used in location directive is same as
if otel_span_attr directive is used in server directive.

  • The bug is reproducible with the latest version of nginx
  • The nginx configuration is minimized to the smallest possible
    to reproduce the issue and doesn't contain third-party modules

nginx configuration

load_module modules/ngx_otel_module.so;

http {
  otel_exporter {
    endpoint "collector:4317";
  }

  server {
    location / {
      otel_trace on;
      otel_trace_context propagate;
      otel_span_attr deployment.environment.name "dev";

      try_files $uri /index.php/$request_uri;
    }

    location ~ ^/index\.php(/|$) {
      fastcgi_pass php:9000;
    }
  }
}

or share the configuration in gist.

nginx debug log

It is advised to enable
debug logging.

# Your nginx debug log here

or share the debug log in gist.

Workaround

Move location directives on server.

  # ...
  server {
    otel_trace on;
    otel_trace_context propagate;
    otel_span_attr deployment.environment.name "dev";

    location / {
      try_files $uri /index.php/$request_uri;
    }
    # ...
@alquerci alquerci added the bug label Sep 18, 2024
@ninaforsyth
Copy link

https://github.com/nginxinc/nginx-otel might be a better place to post this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants
@alquerci @ninaforsyth and others