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

[Part0] Support Activity Status and status description in Console Exporter. #3061

Merged
merged 9 commits into from
Mar 17, 2022

Conversation

Yun-Ting
Copy link
Contributor

@Yun-Ting Yun-Ting commented Mar 16, 2022

Related to #2569.

Changes

Added support to to set status with Activity.Status, which was introduced in System.Diagnostic.DiagnosticSource 6.0.0 to ConsoleExporter.
The same idea will be applied to other exporters.

Case 1:
Setting activity status to be OK.
activity.SetStatus(ActivityStatusCode.Ok);
Output:
StatusCode : OK

Case 2:
Setting activity status to be ERROR with description.
activity.SetStatus(ActivityStatusCode.Error, "desc");
Output:

StatusCode : ERROR
Error : desc

Case 3:
Setting activity tag to be OK.
activity.SetTag("otel.status_code", "OK");
Output:

Activity.Tags:
   StatusCode : OK

Case 4:
Setting activity tag to be ERROR with description.

activity.SetTag("otel.status_code", "ERROR");
activity.SetTag("otel.status_description", "desc");

Output:

Activity.Tags:
   StatusCode : ERROR
   Error : desc

Case 5:
Activity status take precedence over activity tag when both were set.

activity.SetStatus(ActivityStatusCode.Ok);
activity.SetTag("otel.status_code", "ERROR");
activity.SetTag("otel.status_description", "desc");

Output:

Activity.Tags:
StatusCode : OK

Case 6:
Activity status take precedence over activity tag when both were set.

activity.SetStatus(ActivityStatusCode.Error, "desc");
activity.SetTag("otel.status_code", "OK");

Output:

Activity.Tags:
StatusCode : ERROR
Error : desc

For significant contributions please make sure you have completed the following items:

  • Appropriate CHANGELOG.md updated for non-trivial changes
  • Design discussion issue #
  • Changes in public API reviewed

@Yun-Ting Yun-Ting marked this pull request as ready for review March 17, 2022 00:00
@Yun-Ting Yun-Ting requested a review from a team March 17, 2022 00:00
@codecov
Copy link

codecov bot commented Mar 17, 2022

Codecov Report

Merging #3061 (21f8eec) into main (b6169aa) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3061   +/-   ##
=======================================
  Coverage   84.70%   84.70%           
=======================================
  Files         259      259           
  Lines        9119     9119           
=======================================
  Hits         7724     7724           
  Misses       1395     1395           

{
this.WriteLine($" StatusCode : {statusCode}");
this.WriteLine($"Error : {activity.StatusDescription}");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove "Error". Just Status Description is good enough here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe something like:
this.WriteLine($"Status Description : {activity.StatusDescription}");
?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@cijothomas cijothomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit comment. may be addressed separate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants