Skip to content

Commit c6afbd0

Browse files
author
Alex Boten
committed
opentelemetry-instrumentation-flask fix recording bug
Fix open-telemetry#998
1 parent 8fc95ca commit c6afbd0

File tree

1 file changed

+2
-2
lines changed
  • instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask

1 file changed

+2
-2
lines changed

instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def _start_response(status, response_headers, *args, **kwargs):
153153
otel_wsgi.add_response_attributes(
154154
span, status, response_headers
155155
)
156-
if span.kind == trace.SpanKind.SERVER:
156+
if span.is_recording() and span.kind == trace.SpanKind.SERVER:
157157
otel_wsgi.add_custom_response_headers(
158158
span, response_headers
159159
)
@@ -204,7 +204,7 @@ def _before_request():
204204
] = flask.request.url_rule.rule
205205
for key, value in attributes.items():
206206
span.set_attribute(key, value)
207-
if span.kind == trace.SpanKind.SERVER:
207+
if span.is_recording() and span.kind == trace.SpanKind.SERVER:
208208
otel_wsgi.add_custom_request_headers(
209209
span, flask_request_environ
210210
)

0 commit comments

Comments
 (0)