Skip to content

Commit 90d0b9a

Browse files
committed
try to fix
1 parent 10fa0c7 commit 90d0b9a

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

instrumentation/opentelemetry-instrumentation-asgi/tests/test_asgi_custom_headers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ def setUp(self):
352352
}
353353
)
354354
super().setUp()
355-
355+
356356
def tearDown(self):
357357
os.environ.pop(OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SANITIZE_FIELDS, None)
358358
os.environ.pop(OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SERVER_REQUEST, None)

instrumentation/opentelemetry-instrumentation-django/src/opentelemetry/instrumentation/django/middleware/otel_middleware.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
from opentelemetry.util.http import (
4646
OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SANITIZE_FIELDS,
4747
OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SERVER_REQUEST,
48+
OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SERVER_RESPONSE,
4849
SanitizeValue,
4950
_parse_active_request_count_attrs,
5051
_parse_duration_attrs,
@@ -351,14 +352,14 @@ def process_response(self, request, response):
351352

352353
custom_res_attributes = (
353354
asgi_collect_custom_headers_attributes(
354-
custom_headers,
355+
{'headers': custom_headers},
355356
SanitizeValue(
356357
get_custom_headers(
357358
OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SANITIZE_FIELDS
358359
)
359360
),
360361
get_custom_headers(
361-
OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SERVER_REQUEST
362+
OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SERVER_RESPONSE
362363
),
363364
normalise_request_header_name,
364365
)

instrumentation/opentelemetry-instrumentation-django/tests/test_middleware_asgi.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,8 @@ async def test_http_custom_response_headers_in_span_attributes(self):
537537
),
538538
"http.response.header.my_secret_header": ("[REDACTED]",),
539539
}
540-
await self.async_client.get("/traced_custom_header/")
540+
resp = await self.async_client.get("/traced_custom_header/")
541+
assert resp.status_code == 200
541542
spans = self.exporter.get_finished_spans()
542543
self.assertEqual(len(spans), 1)
543544

0 commit comments

Comments
 (0)