Skip to content

Commit

Permalink
Fix tornado instrumentation's usage of Span Status (#504)
Browse files Browse the repository at this point in the history
  • Loading branch information
owais authored May 24, 2021
1 parent c8ec25a commit f4a2b61
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.2.0-0.21b0...HEAD)

- Fixed cases where description was used with non-error status code when creating Status objects.
([#504](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/504))

### Added
- `opentelemetry-instrumentation-botocore` now supports
context propagation for lambda invoke via Payload embedded headers.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def client_resposne_hook(span, future):
)
from opentelemetry.propagate import extract
from opentelemetry.semconv.trace import SpanAttributes
from opentelemetry.trace.status import Status
from opentelemetry.trace.status import Status, StatusCode
from opentelemetry.util._time import _time_ns
from opentelemetry.util.http import get_excluded_urls, get_traced_request_attrs

Expand Down Expand Up @@ -299,10 +299,14 @@ def _finish_span(tracer, handler, error=None):

if ctx.span.is_recording():
ctx.span.set_attribute(SpanAttributes.HTTP_STATUS_CODE, status_code)
otel_status_code = http_status_to_status_code(status_code)
otel_status_description = None
if otel_status_code is StatusCode.ERROR:
otel_status_description = reason
ctx.span.set_status(
Status(
status_code=http_status_to_status_code(status_code),
description=reason,
status_code=otel_status_code,
description=otel_status_description,
)
)

Expand Down

0 comments on commit f4a2b61

Please sign in to comment.