@@ -96,10 +96,7 @@ def __call__(self, request):
96
96
try :
97
97
from opentelemetry .instrumentation .asgi import asgi_getter , asgi_setter
98
98
from opentelemetry .instrumentation .asgi import (
99
- collect_custom_headers_attributes as asgi_collect_custom_request_attributes ,
100
- )
101
- from opentelemetry .instrumentation .asgi import (
102
- collect_custom_response_headers_attributes as asgi_collect_custom_response_attributes ,
99
+ collect_custom_headers_attributes as asgi_collect_custom_headers_attributes ,
103
100
)
104
101
from opentelemetry .instrumentation .asgi import (
105
102
collect_request_attributes as asgi_collect_request_attributes ,
@@ -254,16 +251,16 @@ def process_request(self, request):
254
251
)
255
252
if span .is_recording () and span .kind == SpanKind .SERVER :
256
253
attributes .update (
257
- asgi_collect_custom_request_attributes (
254
+ asgi_collect_custom_headers_attributes (
258
255
carrier ,
259
- get_custom_headers (
260
- OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SERVER_REQUEST
261
- ),
262
256
SanitizeValue (
263
257
get_custom_headers (
264
258
OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SANITIZE_FIELDS
265
259
)
266
260
),
261
+ get_custom_headers (
262
+ OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SERVER_REQUEST
263
+ ),
267
264
normalise_request_header_name ,
268
265
)
269
266
)
@@ -353,7 +350,18 @@ def process_response(self, request, response):
353
350
asgi_setter .set (custom_headers , key , value )
354
351
355
352
custom_res_attributes = (
356
- asgi_collect_custom_response_attributes (custom_headers )
353
+ asgi_collect_custom_headers_attributes (
354
+ custom_headers ,
355
+ SanitizeValue (
356
+ get_custom_headers (
357
+ OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SANITIZE_FIELDS
358
+ )
359
+ ),
360
+ get_custom_headers (
361
+ OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SERVER_REQUEST
362
+ ),
363
+ normalise_request_header_name ,
364
+ )
357
365
)
358
366
for key , value in custom_res_attributes .items ():
359
367
span .set_attribute (key , value )
0 commit comments