Description
Component
OpenTelemetry.Instrumentation.AspNetCore
Is your feature request related to a problem?
We operate a mixed environment that involves vendor interaction with our systems. We have found the Open Telemetry incoming HTTP instrumentation easily broken when our vendor(s) sets the traceparent header. There's no way to ignore those headers and still use open telemetry with the aspnetcore instrumentation.
The current "Filter" option only is useful if we don't want telemetry or traces at all from a source. This feature would allow us to not be affected by up-stream systems that aren't part of our own open telemetry eco-system, but might be leaking these open telemetry headers, yet still allow us to trace these transactions with ourselves as the starting parent.
What is the expected behavior?
If an origin is in a configurable list, then the instrumentation should ignore any traceparent that might come from the http headers.
Which alternative solutions or features have you considered?
Writing middleware that does essentially the same thing and removes the traceparent header before the instrumentation takes effect.
Additional context
After evaluating the source code, here's a possible solution. First add the list of URIs that you don't want to be part of your trace lineage to the options and then 1 or 2:
- Within the
OpenTelemetry.Instrumentation.AspNetCore.Implementation.HttpInListener
inOnStartActivity
, when it goes to create theTextMapPropagator,
don't consider the http headers. - Before it gets to that step where it creates the
TextMapPropagator
, simply removes thetraceparent
header from the request headers before logical evaluation.