Skip to content

[bug] No traces for AspNetCore instrumentation when AppService has CORS turned ON (traceparent header exists) #2206

Open
@wallyrion

Description

@wallyrion

Component

OpenTelemetry.Instrumentation.AspNetCore

Package Version

Package Name Version
OpenTelemetry.Instrumentation.AspNetCore 1.9.0
OpenTelemetry 1.9.0
OpenTelemetry.Exporter.OpenTelemetryProtocol 1.9.0

Runtime Version

net8.0

Description

When deploying an application to Azure App Service with CORS enabled, traces generated by OpenTelemetry.Instrumentation.AspNetCore are not being created. Changing the exporter has no effect on this behavior. However, traces from other sources, such as EntityFrameworkCore and HttpClient instrumentation, are successfully exported.

The key difference between requests when CORS is enabled versus disabled in App Service is the presence of the traceparent header (e.g., traceparent: 00-63beafd20fc56a364971ebee560f6e9c-ad151c22e8fbe470-00). This header seems to be the likely cause of the missing traces when CORS is active.

Steps to Reproduce

When CORS is enabled, additional headers are introduced:
traceparent: 00-63beafd20fc56a364971ebee560f6e9c-ad151c22e8fbe470-00
Content-Length: 0

You can see my sample app here https://github.com/wallyrion/OpenTelemetry.AppService.CorsIssue

Expected Result

I'm not sure about the expected behaviour here.

Actual Result

Http traces are not created and this is not obvious at all.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcomp:instrumentation.aspnetcoreThings related to OpenTelemetry.Instrumentation.AspNetCore

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions