mirror of
https://github.com/open-telemetry/opentelemetry-python-contrib.git
synced 2025-07-28 20:52:57 +08:00
fix non-recording bug (#999)
This commit is contained in:
@ -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)
|
## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.10.0-0.29b0...HEAD)
|
||||||
|
|
||||||
|
- `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
|
## [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
|
- `opentelemetry-instrumentation-wsgi` Capture custom request/response headers in span attributes
|
||||||
([#925])(https://github.com/open-telemetry/opentelemetry-python-contrib/pull/925)
|
([#925])(https://github.com/open-telemetry/opentelemetry-python-contrib/pull/925)
|
||||||
|
|
||||||
- `opentelemetry-instrumentation-flask` Flask: Capture custom request/response headers in span attributes
|
- `opentelemetry-instrumentation-flask` Flask: Capture custom request/response headers in span attributes
|
||||||
([#952])(https://github.com/open-telemetry/opentelemetry-python-contrib/pull/952)
|
([#952])(https://github.com/open-telemetry/opentelemetry-python-contrib/pull/952)
|
||||||
|
|
||||||
- `opentelemetry-instrumentation-tornado` Tornado: Capture custom request/response headers in span attributes
|
- `opentelemetry-instrumentation-tornado` Tornado: Capture custom request/response headers in span attributes
|
||||||
([#950])(https://github.com/open-telemetry/opentelemetry-python-contrib/pull/950)
|
([#950])(https://github.com/open-telemetry/opentelemetry-python-contrib/pull/950)
|
||||||
|
|
||||||
|
@ -153,7 +153,10 @@ def _rewrapped_app(wsgi_app, response_hook=None, excluded_urls=None):
|
|||||||
otel_wsgi.add_response_attributes(
|
otel_wsgi.add_response_attributes(
|
||||||
span, status, response_headers
|
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(
|
otel_wsgi.add_custom_response_headers(
|
||||||
span, response_headers
|
span, response_headers
|
||||||
)
|
)
|
||||||
@ -204,7 +207,7 @@ def _wrapped_before_request(
|
|||||||
] = flask.request.url_rule.rule
|
] = flask.request.url_rule.rule
|
||||||
for key, value in attributes.items():
|
for key, value in attributes.items():
|
||||||
span.set_attribute(key, value)
|
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(
|
otel_wsgi.add_custom_request_headers(
|
||||||
span, flask_request_environ
|
span, flask_request_environ
|
||||||
)
|
)
|
||||||
|
@ -340,7 +340,7 @@ def _start_span(tracer, handler, start_time) -> _TraceContext:
|
|||||||
for key, value in attributes.items():
|
for key, value in attributes.items():
|
||||||
span.set_attribute(key, value)
|
span.set_attribute(key, value)
|
||||||
span.set_attribute("tornado.handler", _get_full_handler_name(handler))
|
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)
|
_add_custom_request_headers(span, handler.request.headers)
|
||||||
|
|
||||||
activation = trace.use_span(span, end_on_exit=True)
|
activation = trace.use_span(span, end_on_exit=True)
|
||||||
@ -395,7 +395,7 @@ def _finish_span(tracer, handler, error=None):
|
|||||||
description=otel_status_description,
|
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)
|
_add_custom_response_headers(ctx.span, handler._headers)
|
||||||
|
|
||||||
ctx.activation.__exit__(*finish_args) # pylint: disable=E1101
|
ctx.activation.__exit__(*finish_args) # pylint: disable=E1101
|
||||||
|
Reference in New Issue
Block a user