We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 28256e2 commit ebc2331Copy full SHA for ebc2331
sentry_sdk/opentelemetry/utils.py
@@ -282,7 +282,12 @@ def infer_status_from_attributes(span_attributes):
282
283
def get_http_status_code(span_attributes):
284
# type: (Mapping[str, str | bool | int | float | Sequence[str] | Sequence[bool] | Sequence[int] | Sequence[float]]) -> Optional[int]
285
- http_status = span_attributes.get(SpanAttributes.HTTP_RESPONSE_STATUS_CODE)
+ try:
286
+ http_status = span_attributes.get(SpanAttributes.HTTP_RESPONSE_STATUS_CODE)
287
+ except AttributeError:
288
+ # HTTP_RESPONSE_STATUS_CODE was added in 1.21, so if we're on an older
289
+ # OTel version this will not work
290
+ http_status = None
291
292
if http_status is None:
293
# Fall back to the deprecated attribute
0 commit comments