1515import os
1616import threading
1717from enum import Enum
18- from typing import Container , Mapping
18+ from typing import Container , Mapping , MutableMapping
1919
2020from opentelemetry .instrumentation .utils import http_status_to_status_code
2121from opentelemetry .semconv ._incubating .attributes .http_attributes import (
@@ -297,14 +297,14 @@ def _filter_semconv_active_request_count_attr(
297297
298298
299299def set_string_attribute (
300- result : Mapping [str , AttributeValue ], key : str , value : AttributeValue
300+ result : MutableMapping [str , AttributeValue ], key : str , value : AttributeValue
301301) -> None :
302302 if value :
303303 result [key ] = value
304304
305305
306306def set_int_attribute (
307- result : dict [str , AttributeValue ], key : str , value : AttributeValue
307+ result : MutableMapping [str , AttributeValue ], key : str , value : AttributeValue
308308) -> None :
309309 if value :
310310 try :
@@ -314,7 +314,7 @@ def set_int_attribute(
314314
315315
316316def _set_http_method (
317- result : dict [str , AttributeValue ],
317+ result : MutableMapping [str , AttributeValue ],
318318 original : str ,
319319 normalized : str ,
320320 sem_conv_opt_in_mode : _StabilityMode ,
@@ -333,7 +333,7 @@ def _set_http_method(
333333
334334
335335def _set_http_status_code (
336- result : dict [str , AttributeValue ],
336+ result : MutableMapping [str , AttributeValue ],
337337 code : str | int ,
338338 sem_conv_opt_in_mode : _StabilityMode ,
339339) -> None :
@@ -344,7 +344,7 @@ def _set_http_status_code(
344344
345345
346346def _set_http_url (
347- result : dict [str , AttributeValue ],
347+ result : MutableMapping [str , AttributeValue ],
348348 url : str ,
349349 sem_conv_opt_in_mode : _StabilityMode ,
350350) -> None :
@@ -355,7 +355,7 @@ def _set_http_url(
355355
356356
357357def _set_http_scheme (
358- result : dict [str , AttributeValue ],
358+ result : MutableMapping [str , AttributeValue ],
359359 scheme : str ,
360360 sem_conv_opt_in_mode : _StabilityMode ,
361361) -> None :
@@ -366,7 +366,7 @@ def _set_http_scheme(
366366
367367
368368def _set_http_flavor_version (
369- result : dict [str , AttributeValue ],
369+ result : MutableMapping [str , AttributeValue ],
370370 version : str ,
371371 sem_conv_opt_in_mode : _StabilityMode ,
372372) -> None :
@@ -377,7 +377,7 @@ def _set_http_flavor_version(
377377
378378
379379def _set_http_user_agent (
380- result : dict [str , AttributeValue ],
380+ result : MutableMapping [str , AttributeValue ],
381381 user_agent : str ,
382382 sem_conv_opt_in_mode : _StabilityMode ,
383383) -> None :
@@ -391,7 +391,7 @@ def _set_http_user_agent(
391391
392392
393393def _set_http_host_client (
394- result : dict [str , AttributeValue ],
394+ result : MutableMapping [str , AttributeValue ],
395395 host : str ,
396396 sem_conv_opt_in_mode : _StabilityMode ,
397397) -> None :
@@ -402,7 +402,7 @@ def _set_http_host_client(
402402
403403
404404def _set_http_net_peer_name_client (
405- result : dict [str , AttributeValue ],
405+ result : MutableMapping [str , AttributeValue ],
406406 peer_name : str ,
407407 sem_conv_opt_in_mode : _StabilityMode ,
408408) -> None :
@@ -413,7 +413,7 @@ def _set_http_net_peer_name_client(
413413
414414
415415def _set_http_peer_port_client (
416- result : dict [str , AttributeValue ],
416+ result : MutableMapping [str , AttributeValue ],
417417 port : str | int ,
418418 sem_conv_opt_in_mode : _StabilityMode ,
419419) -> None :
@@ -424,7 +424,7 @@ def _set_http_peer_port_client(
424424
425425
426426def _set_http_network_protocol_version (
427- result : dict [str , AttributeValue ],
427+ result : MutableMapping [str , AttributeValue ],
428428 version : str ,
429429 sem_conv_opt_in_mode : _StabilityMode ,
430430) -> None :
@@ -438,7 +438,7 @@ def _set_http_network_protocol_version(
438438
439439
440440def _set_http_net_host (
441- result : dict [str , AttributeValue ],
441+ result : MutableMapping [str , AttributeValue ],
442442 host : str ,
443443 sem_conv_opt_in_mode : _StabilityMode ,
444444) -> None :
@@ -449,7 +449,7 @@ def _set_http_net_host(
449449
450450
451451def _set_http_net_host_port (
452- result : dict [str , AttributeValue ],
452+ result : MutableMapping [str , AttributeValue ],
453453 port : str | int ,
454454 sem_conv_opt_in_mode : _StabilityMode ,
455455) -> None :
@@ -460,7 +460,7 @@ def _set_http_net_host_port(
460460
461461
462462def _set_http_target (
463- result : dict [str , AttributeValue ],
463+ result : MutableMapping [str , AttributeValue ],
464464 target : str ,
465465 path : str | None ,
466466 query : str | None ,
@@ -476,7 +476,7 @@ def _set_http_target(
476476
477477
478478def _set_http_host_server (
479- result : dict [str , AttributeValue ],
479+ result : MutableMapping [str , AttributeValue ],
480480 host : str ,
481481 sem_conv_opt_in_mode : _StabilityMode ,
482482) -> None :
@@ -493,7 +493,7 @@ def _set_http_host_server(
493493# https://github.com/open-telemetry/semantic-conventions/blob/v1.21.0/CHANGELOG.md#v1210-2023-07-13
494494# https://github.com/open-telemetry/semantic-conventions/blob/main/docs/non-normative/http-migration.md#common-attributes-across-http-client-and-server-spans
495495def _set_http_peer_ip_server (
496- result : dict [str , AttributeValue ],
496+ result : MutableMapping [str , AttributeValue ],
497497 ip : str ,
498498 sem_conv_opt_in_mode : _StabilityMode ,
499499) -> None :
@@ -506,7 +506,7 @@ def _set_http_peer_ip_server(
506506
507507
508508def _set_http_peer_port_server (
509- result : dict [str , AttributeValue ],
509+ result : MutableMapping [str , AttributeValue ],
510510 port : str | int ,
511511 sem_conv_opt_in_mode : _StabilityMode ,
512512) -> None :
@@ -517,7 +517,7 @@ def _set_http_peer_port_server(
517517
518518
519519def _set_http_net_peer_name_server (
520- result : dict [str , AttributeValue ],
520+ result : MutableMapping [str , AttributeValue ],
521521 name : str ,
522522 sem_conv_opt_in_mode : _StabilityMode ,
523523) -> None :
@@ -529,7 +529,7 @@ def _set_http_net_peer_name_server(
529529
530530def _set_status (
531531 span : Span ,
532- metrics_attributes : dict [str , AttributeValue ],
532+ metrics_attributes : MutableMapping [str , AttributeValue ],
533533 status_code : int ,
534534 status_code_str : str ,
535535 server_span : bool = True ,
0 commit comments