Skip to content

Rewrite doesn't generate a trace #47

@PandeoF1

Description

@PandeoF1

Describe the bug

Hi, i have an nginx configurated with some location.

[...]
location /test {
    otel_trace on;
    otel_trace_context propagate;
    index index.html
}

location /api {
    rewrite /api/(.*) /private_api/$1 break;
    otel_trace on;
    otel_trace_context propagate;
    proxy_pass $api;
    proxy_set_header   Host             $host;
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
}
[...]

I also have a rewrite confs :

rewrite ^/api/(.*) /api/$1  break;
rewrite ^/[^/]+(/.*)$ $1 break;
rewrite ^/[^/]+/(api/.*)$ /$1 break;

When i hit /test the trace are succesfully created
But with /client_name/api/... there is no trace.

I think that otel don't want to create a trace because he detect /client_name/api/ and not /api/ after the

Expected behavior

I want a trace for location after the rewrite
(before: /client_name/api/ -> after: /api/)

Your environment

FROM nginxinc/nginx-unprivileged:1.25.4-bookworm

[...]

USER root
RUN apt update
RUN apt install curl gnupg2 ca-certificates lsb-release debian-archive-keyring -y
RUN curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor | tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
RUN echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \
http://nginx.org/packages/mainline/debian `lsb_release -cs` nginx" \
    | tee /etc/apt/sources.list.d/nginx.list

RUN apt update
RUN apt install nginx-module-otel -y
USER nginx
EXPOSE 80 443
[...]

### Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions