Skip to content

Commit 9b2e8c5

Browse files
committed
Now always add attributes in middleware
1 parent 89d1c23 commit 9b2e8c5

File tree

1 file changed

+11
-12
lines changed
  • instrumentation/opentelemetry-instrumentation-falcon/src/opentelemetry/instrumentation/falcon

1 file changed

+11
-12
lines changed

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

+11-12
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ def __call__(self, env, start_response):
209209
env[_ENVIRON_ACTIVATION_KEY] = activation
210210

211211
def _start_response(status, response_headers, *args, **kwargs):
212-
otel_wsgi.add_response_attributes(span, status, response_headers)
213212
response = start_response(
214213
status, response_headers, *args, **kwargs
215214
)
@@ -280,19 +279,19 @@ def process_response(
280279
if resource is None:
281280
status = "404"
282281
reason = "NotFound"
283-
284-
if _ENVIRON_EXC in req.env:
285-
exc = req.env[_ENVIRON_EXC]
286-
exc_type = type(exc)
287282
else:
288-
exc_type, exc = None, None
289-
if exc_type and not req_succeeded:
290-
if "HTTPNotFound" in exc_type.__name__:
291-
status = "404"
292-
reason = "NotFound"
283+
if _ENVIRON_EXC in req.env:
284+
exc = req.env[_ENVIRON_EXC]
285+
exc_type = type(exc)
293286
else:
294-
status = "500"
295-
reason = "{}: {}".format(exc_type.__name__, exc)
287+
exc_type, exc = None, None
288+
if exc_type and not req_succeeded:
289+
if "HTTPNotFound" in exc_type.__name__:
290+
status = "404"
291+
reason = "NotFound"
292+
else:
293+
status = "500"
294+
reason = "{}: {}".format(exc_type.__name__, exc)
296295

297296
status = status.split(" ")[0]
298297
try:

0 commit comments

Comments
 (0)