Skip to content

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

Merged
utpilla merged 6 commits intoopen-telemetry:mainfrom
TimothyMothra:4983_statusDescription
Nov 9, 2023
Merged

[AspNetCore] [Http] remove Activity Status Description and update unit tests#5025
utpilla merged 6 commits intoopen-telemetry:mainfrom
TimothyMothra:4983_statusDescription

Conversation

@TimothyMothra
Copy link
Copy Markdown

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
@codecov
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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?)


## Unreleased

* On Exception, Activity Status is set to Error. The Exception Message
Copy link
Copy Markdown
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