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

[AspNetCore] [Http] remove Activity Status Description and update unit tests #5025

Merged
merged 6 commits into from
Nov 9, 2023

Conversation

TimothyMothra
Copy link
Contributor

Towards #4983

Previously, these libraries were setting both the Activity Status & StatusDescription via Activity.SetStatus(ActivityStatusCode, Description). This PR removes the string description.

The Http spec states:

Don't set the span status description if the reason can be inferred from http.response.status_code.
https://github.com/open-telemetry/semantic-conventions/blob/v1.23.0/docs/http/http-spans.md#status

Changes

  • Instrumentation.AspNetCore
    • Remove StatusDescription
  • Instrumentation.AspNetCore.Tests
    • update unit tests
  • Instrumentation.Http
    • Remove StatusDescription and light refactor.
  • Instrumentation.Http.Tests
    • update unit tests
    • update json tests and data model
      • remove StatusDescription from json test cases
      • remove StatusDescription fram data model

Merge requirement checklist

  • CONTRIBUTING guidelines followed (nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

@TimothyMothra TimothyMothra requested a review from a team November 3, 2023 22:50
Copy link

codecov bot commented Nov 3, 2023

Codecov Report

Merging #5025 (a27b093) into main (4a3c8d3) will decrease coverage by 0.35%.
The diff coverage is 90.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5025      +/-   ##
==========================================
- Coverage   83.60%   83.26%   -0.35%     
==========================================
  Files         296      296              
  Lines       12452    12440      -12     
==========================================
- Hits        10411    10358      -53     
- Misses       2041     2082      +41     
Flag Coverage Δ
unittests 83.26% <90.00%> (-0.35%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...tation.AspNetCore/Implementation/HttpInListener.cs 91.87% <100.00%> (ø)
...tp/Implementation/HttpHandlerDiagnosticListener.cs 73.50% <100.00%> (ø)
...plementation/HttpWebRequestActivitySource.netfx.cs 83.13% <87.50%> (-0.01%) ⬇️

... and 6 files with indirect coverage changes

Copy link
Member

@vishweshbankwar vishweshbankwar left a comment

Choose a reason for hiding this comment

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

LGTM - needs changelog.

For future:

Don't set the span status description if the reason can be inferred from http.response.status_code

Should get clarification from spec what happens when the response code is not available. Should we be setting the description in this case? If yes, then we can update it later(Post GA) (it won't be a breaking change).

@cijothomas
Copy link
Member

LGTM - needs changelog.

Please do mention that EnrichWithException can be leveraged to get back the old behavior. This is important as this was the behavior for a very long time, so need to smoothen upgrade/migrate disruptions.

@cijothomas
Copy link
Member

https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-status
When the status is set to Error by Instrumentation Libraries, the Description SHOULD be documented and predictable. The status code should only be set to Error according to the rules defined within the semantic conventions. For operations not covered by the semantic conventions, Instrumentation Libraries SHOULD publish their own conventions, including possible values of Description and what they mean.

The above section talks about guidelines on Description. Putting exception message may not meet this requirement (as exc. message could be unpredictable/not-easy-to-document as it is not a finite list?)

@@ -2,6 +2,13 @@

## Unreleased

* On Exception, Activity Status is set to Error. The Exception Message
Copy link
Member

@vishweshbankwar vishweshbankwar Nov 7, 2023

Choose a reason for hiding this comment

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

Removed the Activity Status Description that was being set during unhandled exceptions. Activity Status will continue to be reported as Error

something like this would be more clear IMO

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.

4 participants