Skip to content
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

Support Status and StatusDescription from Activity class. #3112

Closed
Yun-Ting opened this issue Mar 30, 2022 · 1 comment · Fixed by open-telemetry/opentelemetry-dotnet-contrib#651
Labels
documentation Documentation related enhancement New feature or request

Comments

@Yun-Ting
Copy link
Contributor

Yun-Ting commented Mar 30, 2022

Feature summary

Prior to DiagnosticSource version 6.0.0, there is no native support from Activity class to set ActivityStatus and StatusDescription.

As a workaround, setting the status of an Activity was provided by the .NET OpenTelemetry API via the Activity.SetStatus extension method in the OpenTelemetry.Trace namespace. Internally, this extension method added the status as tags on the Activity: otel.status_code and otel.status_description.

Starting from version 6.0.0 in DiagnosticSource, there are two new properties added to Activity class - Status and StatusDescription.

To add support for setting status on Activity class with SetStatus(ActivityStatusCode, String) API, the below code changes on all core Exporters were made:
(Console Exporter as proof of concept, Zipkin Exporter, Jaeger Exporter and OTLP Exporter).

Note that this is not a breaking change -
to maintain backward compatibility, the exporters would fall back to use the tags:otel.status_code and otel.status_description, which were set with Activity Extension method to infer status.

Describe alternatives you've considered.

Adding support to set Activity Status natively onto the core SDK: prototype.
Compared to add support to native Activity status onto the core SDK, the pros of supporting it in all Exporters are:

  1. Preventing performance penalty in enumerating all the activity tags in the core SDK.
  2. Less maintenance/migration effort when the time comes on stop supporting setting status via activity tags.

Additional Context

Related to #2569.

@Yun-Ting Yun-Ting added the enhancement New feature or request label Mar 30, 2022
@cijothomas cijothomas added the documentation Documentation related label Mar 30, 2022
@cijothomas
Copy link
Member

This is done as of 1.2.0-rc4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Documentation related enhancement New feature or request
Projects
None yet
2 participants