Skip to content

Block Transparent Trace Context from Http Requests based on Filter #2050

Open
@stevenmolencsat

Description

@stevenmolencsat

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:

  1. Within the OpenTelemetry.Instrumentation.AspNetCore.Implementation.HttpInListener in OnStartActivity, when it goes to create the TextMapPropagator, don't consider the http headers.
  2. Before it gets to that step where it creates the TextMapPropagator, simply removes the traceparent header from the request headers before logical evaluation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    comp:instrumentation.aspnetcoreThings related to OpenTelemetry.Instrumentation.AspNetCorequestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions