Azure / Azure/azure-functions-host
Host-emitted Microsoft.AspNetCore server spans intermittently missing faas.* attributes under concurrent load (isolated worker, OpenTelemetry mode)
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 36
Description
#### Investigative information
- Timestamp: `2026-08-19T08:08:41.308882Z` (one concrete example below; the issue is systemic, not a single occurrence — see repro)
- Function App version: `4.1048.0.0` (local Core Tools host runtime; also confirmed present in host runtime `4.1052.300.26370` on a Flex Consumption deployment)
- Function App name: N/A — reproduced via the included local minimal repro, not a shared production app
- Function name(s): `HelloWorld` (HTTP trigger)
- Invocation ID: N/A
- Region: N/A (local reproduction)
#### Repro steps
Minimal, self-contained repro (running a local OpenTelemetry Collector and captures raw OTLP export data to a file):
https://github.com/danielgblanco/azure-functions-worker-otel-repro
Step to reproduce in README, however for simplicity:
1. `dotnet build`
2. Download `otelcol-contrib` (needed for the `file` exporter) and start it: `./.otelcol/otelcol-contrib --config otelcol-config.yaml`
3. `dotnet run` (starts the Functions Host + isolated worker with `"telemetryMode": "OpenTelemetry"` in `host.json`)
4. `./repro.sh http://localhost:7071/api/helloworld 180 30` (send concurrent load)
5. `python3 analyze_otlp.py otlp-spans.json`
#### Expected behavior
Every invocation's host-emitted `Microsoft.AspNetCore` server span (`GET api/HelloWorld`) should have `faas.invocation_id`, `faas.instance`, `faas.name`, and `faas.trigger`, regardless of concurrent load.
#### Actual behavior
The host-emitted root span intermittently loses its `faas.*` attributes under concurrent load. In the captured run: 240 host spans total, 52 missing `faas.invocation_id` (~22%). Across three separate 60-request runs at 15 concurrency: 33%, 35%, and 62% missing. Affected spans are valid root spans (`parentSpanId` empty) with unique trace IDs (i.e. not duplicates, not malformed, not trace-id collisions). The enrichment step that attaches `faas.*` to the host's own span might be losing the race under concurrency.
#### Known workarounds
None known.
#### Related information
* Programming language used: C# (.NET 10, isolated worker model, `AzureFunctionsVersion v4`)
* Links to source: [Program.cs](https://github.com/danielgblanco/azure-functions-worker-otel-repro/blob/main/Program.cs), [HelloWorld.cs](https://github.com/danielgblanco/azure-functions-worker-otel-repro/blob/main/HelloWorld.cs)
* Bindings used: HTTP trigger (`Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore` 2.1.1)
* Package versions: `Microsoft.Azure.Functions.Worker` 2.52.0, `Microsoft.Azure.Functions.Worker.OpenTelemetry` 1.2.0, `Microsoft.Azure.Functions.Worker.Sdk` 2.1.0, `OpenTelemetry.*` 1.17.0
* Related but distinct issues already checked: #10560 (semantic convention naming), #11745 (sampler env vars ignored)
Contributor guide
Assessment
This issue has not been assessed yet.