opentelemetry-js
opentelemetry-js copied to clipboard
Fetch instrumentation does not keep original request headers
Please answer these questions before submitting a bug report.
What version of OpenTelemetry are you using?
0.19
What version of Node are you using?
v15.13.0
Please provide the code you used to setup the OpenTelemetry SDK
const tracerProvider = new WebTracerProvider(config.telemetry.provider)
tracerProvider.addSpanProcessor(new BatchSpanProcessor(new ZipkinExporter(config.telemetry.exporter)))
tracerProvider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()))
registerInstrumentations({
instrumentations: [new DocumentLoadInstrumentation(), new FetchInstrumentation()],
tracerProvider,
})
tracerProvider.register({ contextManager: new ZoneContextManager() })
What did you do?
Nothing more than installing the packages and adding the above snippet imported at the entrypoint of the application.
What did you expect to see?
Original request headers (notably a x-authorization header for authenticated requests) to be left in the instrumented request.
What did you see instead?
Original request headers are stripped, only the traceparent header is present.
Additional context
The fetch instrumentation is preventing any and all authenticated requests (which, given the application I'm working on, is all of them).

Seems to work for me in Chrome and Safari. What browser and version are you using?
@SolarLiner any chance that you can help me reproduce it?
https://github.com/open-telemetry/opentelemetry-js/issues/2466 could be a possible cause.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.
I think this issue was fixed by #2466 @SolarLiner can you please confirm? If not I will close this issue in a week
@dyladan : Do you missing the close? Regards, Sascha