dotnet / dotnet/dotnet-api-docs

Provide clarity around `OperationName` and `DisplayName` properties on `Activity`

Open
#11,256 3 comments 0 reactions 0 assignees View on GitHub
area-System.Diagnostics.Activity
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

### Type of issue

Missing information

### Description

I was rather suprised to find that if you create an `Activity` and set both the `OperationName` (via the constructor) and `DisplayName` properties, then it is the `DisplayName` that ends up as the `name` of the span exported by the OtlpExporter, and `OperationName` is not present in the output at all.

https://github.com/open-telemetry/opentelemetry-dotnet/blob/ceebd456f14220a460a9257dbbd22ad7611afdd6/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/Serializer/ProtobufOtlpTraceSerializer.cs#L232

Looking in to this further, I think this is intentional. The `DisplayName` is to all intents and purposes the actual name of the span, whilst the `OperationName` is presumably there for doing advanced filtering, enrichment, etc _inside the process_.

Could you get some clarity from the authors and add this usage info to the docs. At the moment they read more like both properties will appear, and that `OperationName` is more likely to end up as the `name`.

### Page URL

https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.activity.displayname?view=net-9.0#system-diagnostics-activity-displayname

### Content source URL

https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System.Diagnostics/Activity.xml

### Document Version Independent Id

09fad89b-f334-4588-0adf-bdefda4ae08b

### Platform Id

90a5639e-a7f2-4ed2-10b6-651df86945da

### Article author

@dotnet-bot

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.