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 #2569

Closed
vishweshbankwar opened this issue Nov 6, 2021 · 4 comments
Closed

Support Status and StatusDescription from Activity class #2569

vishweshbankwar opened this issue Nov 6, 2021 · 4 comments
Labels
enhancement New feature or request pkg:OpenTelemetry.Api Issues related to OpenTelemetry.Api NuGet package
Milestone

Comments

@vishweshbankwar
Copy link
Member

vishweshbankwar commented Nov 6, 2021

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

With this change in Activity class there are 3 possible ways status can be set on Activity:

  1. _activity.SetTag("otel.status_code", "StatusCode"), _activity.SetTag("otel.status_description", "Error description")
  2. _activity.SetStatus(StatusCode) using ActivityExtensions
  3. _activity.SetStatus(ActivityStatusCode, desc) using Activity api.

Goal
Support new changes in exporters while maintaining backward compatibility.

Proposal

  1. Going forward, have SetStatus(ActivityStatusCode, String) as the recommended way for setting status on activity.
  2. Set Status and StatusDescription on activity using tags otel.status_code and otel.status_description respectively in SDK. This can be done in OnEnd() call of BaseExportProcessor. The feature will be turned on by default and can be disabled using a switch. Users already migrated to new Api will be recommended to turn off this feature.
  3. Update exporters shipped from this repo to look up Status and StatusDescription to export activity status details. As the feature noted in 2) is on by default, anyone using _activity.SetStatus(StatusCode) via ActivityExtensions or setting status tags directly will not be impacted.
  4. Update SetStatus(StatusCode) in ActivityExtensions to also set Status and StatusDescription.
  5. Update the instrumentation libraries to use SetStatus(ActivityStatusCode, String) as the libraries are still in rc phase.
  6. Update docs to reflect these new changes.
@tnovacik
Copy link

This issue is closed but in the version of OpenTelemetry 1.0.0-beta2 call of the method SetStatus, doesn't propagate tag otel.status_code to ERROR. I am using it in the .net 6.0 project.

@cijothomas
Copy link
Member

This issue is not fixed, and this issue is, hence, not closed.

@Yun-Ting
Copy link
Contributor

Meeting notes from 2/8/2022 SIG meeting:
ActivityStatus migration
@cijothomas - prefers to let every Exporters deal with it than handling it in SDK
Modify all core exporters from this repo to handle this
Modify “Write own exporter” doc to talk about things changing between each .NET versions.

The pros of supporting setting status with native Status in all the Exporters are:

  1. Prevent perf 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.

@cijothomas
Copy link
Member

Closing as this is completed as of 1.2.0-rc4.
Also see #3112

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pkg:OpenTelemetry.Api Issues related to OpenTelemetry.Api NuGet package
Projects
None yet
Development

No branches or pull requests

5 participants