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

Align HTTP status code as span data field http.response.status_code #2113

Merged
merged 18 commits into from
Jun 6, 2023

Conversation

antonpirker
Copy link
Member

@antonpirker antonpirker commented May 15, 2023

Send HTTP status codes as an integer in a Span data field called http.response.status_code.

This will align us with OTel. Also see:

Fixes #2099

@antonpirker antonpirker changed the title Save http.status_code everywhere in same format. Align HTTP status code as span data field http.status_code May 15, 2023
@antonpirker antonpirker changed the title Align HTTP status code as span data field http.status_code Align HTTP status code as span data field http.response.status_code Jun 5, 2023
@antonpirker
Copy link
Member Author

A note:

The OTel docs for their semantic conventions [1] say that it is called http.response.status_code (this is what we implemented)

But the OTel Python SDK still uses http.status_code [2].

Anyhow, the Sentry Otel integrations uses the variables from the OTel Python SDK, so if an OTel span has http.status_code set it will be transformed into http.response.status_code in the Sentry span and everything is fine.

1: https://opentelemetry.io/docs/specs/otel/metrics/semantic_conventions/http-metrics/#http-server
2: https://github.com/open-telemetry/opentelemetry-python/blob/9706ed004ae3c35ab393fb48c3d71d0c40e8c62b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py#L279

@antonpirker antonpirker marked this pull request as ready for review June 5, 2023 13:22
@antonpirker antonpirker requested a review from sentrivana June 5, 2023 13:25
Copy link
Contributor

@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

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

One typo, otherwise LGTM

sentry_sdk/consts.py Outdated Show resolved Hide resolved
Co-authored-by: Ivana Kellyerova <[email protected]>
@antonpirker antonpirker enabled auto-merge (squash) June 6, 2023 08:05
@antonpirker antonpirker merged commit 692d099 into master Jun 6, 2023
@antonpirker antonpirker deleted the antonpirker/2099-http-status-code branch June 6, 2023 08:11
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.

Normalize http.response.status_code for Metrics & Alerts
2 participants