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

Span status from HTTP code: Do not set status message if it can be inferred #1681

Merged

Conversation

matej-g
Copy link
Contributor

@matej-g matej-g commented Mar 9, 2021

Relevant specification section:

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

The rationale

Although method SpanStatusFromHTTPStatusCode is not directly responsible for setting the span status code and message, many instrumentation packages depend directly on it to set the span status. This puts the burden of setting the appropriate span message on those instrumentation packages.

The change presented in this PR ensures that method SpanStatusFromHTTPStatusCode returns span status code and message which can be directly used and would adhere to the requirements, i.e. for error statuses where the reason can be inferred from http.status_code attribute, the span status message will be unset (empty).

Resolves (partially) #1376

@codecov
Copy link

codecov bot commented Mar 9, 2021

Codecov Report

Merging #1681 (93fa590) into main (9c305bd) will not change coverage.
The diff coverage is 100.0%.

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #1681   +/-   ##
=====================================
  Coverage   77.2%   77.2%           
=====================================
  Files        128     128           
  Lines       6788    6788           
=====================================
  Hits        5246    5246           
  Misses      1291    1291           
  Partials     251     251           
Impacted Files Coverage Δ
semconv/http.go 95.2% <100.0%> (ø)

@matej-g matej-g marked this pull request as ready for review March 9, 2021 08:37
semconv/http.go Outdated Show resolved Hide resolved
@MrAlias MrAlias merged commit 58f69f0 into open-telemetry:main Mar 10, 2021
@MrAlias MrAlias mentioned this pull request Mar 18, 2021
@pellared pellared added this to the untracked milestone Nov 8, 2024
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.

5 participants