Skip to content

Commit

Permalink
fix non-recording bug (#999)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Boten authored Mar 15, 2022
1 parent 8fc95ca commit 640b117
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

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

## [1.10.0-0.29b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.10.0-0.29b0) - 2022-03-10

- `opentelemetry-instrumentation-flask` Fix non-recording span bug
([#999])(https://github.com/open-telemetry/opentelemetry-python-contrib/pull/999)
- `opentelemetry-instrumentation-tornado` Fix non-recording span bug
([#999])(https://github.com/open-telemetry/opentelemetry-python-contrib/pull/999)

## [1.10.0-0.29b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.10.0-0.29b0) - 2022-03-10

- `opentelemetry-instrumentation-wsgi` Capture custom request/response headers in span attributes
([#925])(https://github.com/open-telemetry/opentelemetry-python-contrib/pull/925)

- `opentelemetry-instrumentation-flask` Flask: Capture custom request/response headers in span attributes
([#952])(https://github.com/open-telemetry/opentelemetry-python-contrib/pull/952)

- `opentelemetry-instrumentation-tornado` Tornado: Capture custom request/response headers in span attributes
([#950])(https://github.com/open-telemetry/opentelemetry-python-contrib/pull/950)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ def _start_response(status, response_headers, *args, **kwargs):
otel_wsgi.add_response_attributes(
span, status, response_headers
)
if span.kind == trace.SpanKind.SERVER:
if (
span.is_recording()
and span.kind == trace.SpanKind.SERVER
):
otel_wsgi.add_custom_response_headers(
span, response_headers
)
Expand Down Expand Up @@ -204,7 +207,7 @@ def _before_request():
] = flask.request.url_rule.rule
for key, value in attributes.items():
span.set_attribute(key, value)
if span.kind == trace.SpanKind.SERVER:
if span.is_recording() and span.kind == trace.SpanKind.SERVER:
otel_wsgi.add_custom_request_headers(
span, flask_request_environ
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def _start_span(tracer, handler, start_time) -> _TraceContext:
for key, value in attributes.items():
span.set_attribute(key, value)
span.set_attribute("tornado.handler", _get_full_handler_name(handler))
if span.kind == trace.SpanKind.SERVER:
if span.is_recording() and span.kind == trace.SpanKind.SERVER:
_add_custom_request_headers(span, handler.request.headers)

activation = trace.use_span(span, end_on_exit=True)
Expand Down Expand Up @@ -395,7 +395,7 @@ def _finish_span(tracer, handler, error=None):
description=otel_status_description,
)
)
if ctx.span.kind == trace.SpanKind.SERVER:
if ctx.span.is_recording() and ctx.span.kind == trace.SpanKind.SERVER:
_add_custom_response_headers(ctx.span, handler._headers)

ctx.activation.__exit__(*finish_args) # pylint: disable=E1101
Expand Down

0 comments on commit 640b117

Please sign in to comment.