-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Provide clarity around OperationName
and DisplayName
properties on Activity
#11256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The Activity.DisplayName remarks is already mentioning:
While the Activity.OperationName Remarks mention the following:
What more clarification do you think we need to add? Feel free to submit a PR with your suggestion and we'll be happy to look at. |
The |
OTel has a single concept of Span Name, which is expected to be the low cardinality Span-name, also used for UI. The name can be changed after span creation. Activity.DisplayName is what maps to this. (Operation-name exists as legacy on Activity, not used by OTel). The current remark sections on the properties telling: When adding distributed tracing instrumentation, use DisplayName to set a meaningful name for the activity that will be displayed in tracing tools. This helps in identifying and understanding the trace more easily. For clarity, what exactly do you want to add? |
Type of issue
Missing information
Description
I was rather suprised to find that if you create an
Activity
and set both theOperationName
(via the constructor) andDisplayName
properties, then it is theDisplayName
that ends up as thename
of the span exported by the OtlpExporter, andOperationName
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 theOperationName
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 thename
.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
The text was updated successfully, but these errors were encountered: