Azure / Azure/azure-functions-dotnet-worker

dotnet isolated function EventHubOutput binding doesn't propagate traceparent/tracestate

Open
#2,001 2 comments 1 reaction 0 assignees View on GitHub
logging needs-discussion
Dominant language
C#
Stars
466
Forks
215
Avg merge
3d 10h
Merged PRs (30d)
7

Description

I'm trying to get the W3C tracing to work in my logging framework for dotnet isolated functions. We send all our logs to Splunk and so far W3C tracing hasn't been an issue in app services. But since we're using more isolated functions I want it all to be more "automatic" than we have it today for functions.

To try it out I have

- A timer trigger that sends a http request to:
- A http trigger that sends a message to a queue in a service bus using a ServiceBusSender and to a hub ("hub1") in an event hub namespace using a EventHubProducerClient
- A service bus trigger that doesn't do anything
- An event hub trigger that listens to the eventhub "hub1" with an EventHubOutput binding to "hub2"
- An event hub trigger that listens to the eventhub "hub2"

I use the AZURE_EXPERIMENTAL_ENABLE_ACTIVITY_SOURCE environment variable to get the EventHubProducerClient and ServiceBusSender to automatically include traceparent and tracestate in the message.

The timer trigger starts an Activity before it sends the http request. Using a middleware I can ensure that the incoming trace is set in a new Activity. Everything works fine but for the "hub2" trigger. It seems that **the EventHubOutput binding doesn't propagate the traceparent and tracestate**. The _EventHubProducerClient_ propagates these automatically in the message in it's "PropertiesArray" metadata field.

I haven't tried any other output bindings, but my guess is that the issue is the same.

I saw in another issue that adding OpenTelemetry might solve the issue, but it didn't. (`services.AddOpenTelemetry();`)

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the described timer, HTTP, Service Bus, and Event Hub trigger pipeline in an isolated .NET function, then compare the EventHubOutput binding with EventHubProducerClient metadata propagation. Confirm completion when traceparent and tracestate reach the hub2 trigger without relying on OpenTelemetry.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
backend, distributed-systems, observability-sre
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.