Azure / Azure/azure-functions-dotnet-worker

TraceContext remains empty despite Diagnostic-Id in ServiceBusTrigger messages

Open
#1,846 0 comments 1 reaction 0 assignees View on GitHub
area: application-insights extensions: service-bus logging
Dominant language
C#
Stars
466
Forks
215
Avg merge
3d 10h
Merged PRs (30d)
7

Description

In an isolated function that uses a `ServiceBusTrigger`, the input message contains a `Diagnostic-Id` (populated by the Azure SDK). However, it appears that this is not read, as the TraceContext remains empty.

After reviewing the discussion at https://github.com/Azure/azure-functions-dotnet-worker/issues/410, it seems that integrating AppInsights should solve the issue. So I add the following services :

```csharp
services.AddApplicationInsightsTelemetryWorkerService();
services.ConfigureFunctionsApplicationInsights();
```

but it is still empty.

Under what circumstances is the TraceContext valid?

I am testing locally with this configuration:

```xml

```

```shell
Core Tools Version: 4.0.5198 Commit hash: N/A (64-bit)
Function Runtime Version: 4.21.1.20667
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the isolated ServiceBusTrigger scenario with the package and runtime versions listed in the issue. Inspect how the input message's Diagnostic-Id relates to TraceContext, including the Application Insights registrations shown. Done means establishing the conditions under which TraceContext is populated or documenting and fixing the missing propagation.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.