Skip to content

How to set the trace ID (operation ID) based on HTTP header? #6139

Open
@nlykkei

Description

Package

OpenTelemetry

Is your feature request related to a problem?

I want to set the trace ID (operation ID) of a request to an ASP.NET Core application based on a custom HTTP header (correlation-id).

According to the docs, this should be possible using ITelemetryProcessor in the Application Insights SDK:

https://learn.microsoft.com/en-us/azure/azure-monitor/app/api-filtering-sampling?tabs=dotnet%2Cjavascriptwebsdkloaderscript

I'm looking for similar functionality for the Azure.Monitor.OpenTelemetry.AspNetCore package.

All of our upstream services are currently using our custom correlation-id header, so I would like to use this header for the operation ID instead of rewriting each of those client applications to use traceparent OTEL header:

https://learn.microsoft.com/en-us/azure/azure-monitor/app/distributed-trace-data#correlation-headers-using-w3c-tracecontext

How can I set the operation ID for the incoming request based on the value of a custom HTTP header?

What is the expected behavior?

I would like to set the operation ID to the value of a custom HTTP header, instead of having ASP.NET Core generate a random GUID

Which alternative solutions or features have you considered?

I can't find any solutions or workarounds

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds-triageNew issues which have not been classified or triaged by a community memberpkg:OpenTelemetryIssues related to OpenTelemetry NuGet package

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions