opentelemetry-cpp-contrib
opentelemetry-cpp-contrib copied to clipboard
`b3` propagator not working when internal redirect
In APIcast, the opentelemetry instrumentations is working for the default W3C propagator. When trying to switch to b3 propagation type (i.e. opentelemetry_propagate b3;) propagation stops working, even though traces are still being sent to the collector.
Describe your environment
- Platform: linux/amd64
- Openresty/Nginx version: 1.21.4
- Intrumentation: https://github.com/open-telemetry/opentelemetry-cpp-contrib/tree/main/instrumentation/nginx
Steps to reproduce
Trying to narrow down the relevant nginx configuration used in APIcast, simplified for the shake of this issue, it looks something like this:
location / {
content_by_lua_block {
ngx.exec("@otel");
}
}
location @otel {
internal;
opentelemetry_operation_name apicast;
opentelemetry_propagate b3;
proxy_pass http://example.com;
}
What is the expected behavior?
The request propagation of distributed tracing headers for the b3 type. When no parent trace is given, a new trace will be started. So, upstream request to example.com should have the B3 tracing header.
What is the actual behavior?
The distributed tracing headers (i.e. the B3 header) are not propagated and no new trace is started when no parent trace is given. So, the upstream request to example.com does not have the B3 header. Furthermore, if there is a parent trace, the upstream request to example.com has the B3 header being removed.
Additional context This same configuration for W3C propagation type works like a charm.
location / {
content_by_lua_block {
ngx.exec("@otel");
}
}
location @otel {
internal;
opentelemetry_operation_name apicast;
opentelemetry_propagate;
proxy_pass http://example.com;
}