ServiceComposer emits distributed traces usingDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ServiceComposer/ServiceComposer.AspNetCore/llms.txt
Use this file to discover all available pages before exploring further.
System.Diagnostics.ActivitySource, the built-in .NET tracing API. Because ActivitySource ships with the runtime, no extra NuGet packages are required in your handler libraries — traces are emitted automatically once the host application wires up the OpenTelemetry SDK. Two independent activity sources are provided, one per feature, so you can opt into only what you use.
Activity sources
| Feature | Activity source name |
|---|---|
| ViewModel Composition | ServiceComposer.AspNetCore.ViewModelComposition |
| Scatter/Gather | ServiceComposer.AspNetCore.ScatterGather |
CompositionTelemetry:
Setup
Add theOpenTelemetry.Extensions.Hosting NuGet package to your host project, then register the desired source(s) in the OpenTelemetry tracing pipeline.
- ViewModel Composition only
- Scatter/Gather only
- Both sources (wildcard)
What gets traced
ViewModel Composition spans
EachICompositionRequestsHandler execution produces a child span of the ASP.NET Core HTTP server span.
composition.handler span
Operation name:
Display name: Fully qualified handler type name
composition.handlerDisplay name: Fully qualified handler type name
| Tag | Value |
|---|---|
composition.handler.type | Fully qualified handler type name |
composition.handler.namespace | Handler namespace |
composition.event span
Operation name:
Display name: Fully qualified event type nameEmitted when a handler raises an event via
composition.eventDisplay name: Fully qualified event type nameEmitted when a handler raises an event via
context.RaiseEvent<TEvent>(). Appears as a child of the raising handler’s span.| Tag | Value |
|---|---|
composition.event.type | Fully qualified event type name |
composition.event.namespace | Event namespace |
CompositionTelemetry:
Scatter/Gather spans
EachIGatherer execution produces a child span of the ASP.NET Core HTTP server span.
| Field | Value |
|---|---|
| Operation name | scatter-gather.gatherer |
| Display name | Gatherer key |
scatter_gather.gatherer.key | The gatherer key |
Error spans
When any handler, event handler, or gatherer throws an unhandled exception, ServiceComposer setsActivityStatusCode.Error on the span and adds the following tags, plus an exception event following the OpenTelemetry exception semantic conventions:
| Tag | Value |
|---|---|
otel.status_code | "error" |
otel.status_description | Exception message |
Complete example
The following shows a typicalProgram.cs that registers both ServiceComposer and the OpenTelemetry tracing pipeline with an OTLP exporter:
The
AddAspNetCoreInstrumentation() call is optional but recommended — it creates the root HTTP server span that composition and gatherer spans attach to as children, giving you the full request trace tree.