2424)
2525from  kiota_abstractions .store  import  BackingStoreFactory , BackingStoreFactorySingleton 
2626from  opentelemetry  import  trace 
27- from  opentelemetry .semconv .trace  import  SpanAttributes 
27+ from  opentelemetry .semconv .attributes .http_attributes  import  (
28+     HTTP_RESPONSE_STATUS_CODE ,
29+     HTTP_REQUEST_METHOD ,
30+ )
31+ from  opentelemetry .semconv .attributes .network_attributes  import  NETWORK_PROTOCOL_NAME 
32+ from  opentelemetry .semconv .attributes .server_attributes  import  SERVER_ADDRESS 
33+ from  opentelemetry .semconv .attributes .url_attributes  import  URL_SCHEME , URL_FULL 
2834
2935from  kiota_http ._exceptions  import  (
3036    BackingStoreError ,
@@ -529,15 +535,15 @@ async def get_http_response_message(
529535        resp  =  await  self ._http_client .send (request )
530536        if  not  resp :
531537            raise  ResponseError ("Unable to get response from request" )
532-         parent_span .set_attribute (SpanAttributes . HTTP_STATUS_CODE , resp .status_code )
538+         parent_span .set_attribute (HTTP_RESPONSE_STATUS_CODE , resp .status_code )
533539        if  http_version  :=  resp .http_version :
534-             parent_span .set_attribute (SpanAttributes . HTTP_FLAVOR , http_version )
540+             parent_span .set_attribute (NETWORK_PROTOCOL_NAME , http_version )
535541
536542        if  content_length  :=  resp .headers .get ("Content-Length" , None ):
537-             parent_span .set_attribute (SpanAttributes . HTTP_RESPONSE_CONTENT_LENGTH , content_length )
543+             parent_span .set_attribute ("http.response.body.size" , content_length )
538544
539545        if  content_type  :=  resp .headers .get ("Content-Type" , None ):
540-             parent_span .set_attribute ("http.response_content_type " , content_type )
546+             parent_span .set_attribute ("http.response.header.content-type " , content_type )
541547        _get_http_resp_span .end ()
542548        return  await  self .retry_cae_response_if_required (resp , request_info , claims )
543549
@@ -586,15 +592,15 @@ def get_request_from_request_information(
586592        )
587593        url  =  parse .urlparse (request_info .url )
588594        otel_attributes  =  {
589-             SpanAttributes . HTTP_METHOD : request_info .http_method ,
595+             HTTP_REQUEST_METHOD : request_info .http_method ,
590596            "http.port" : url .port ,
591-             SpanAttributes . HTTP_HOST : url .hostname ,
592-             SpanAttributes . HTTP_SCHEME : url .scheme ,
593-             "http .uri_template" : request_info .url_template ,
597+             URL_SCHEME : url .hostname ,
598+             SERVER_ADDRESS : url .scheme ,
599+             "url .uri_template" : request_info .url_template ,
594600        }
595601
596602        if  self .observability_options .include_euii_attributes :
597-             otel_attributes .update ({"http.uri" : url .geturl ()})
603+             otel_attributes .update ({URL_FULL : url .geturl ()})
598604
599605        request  =  self ._http_client .build_request (
600606            method = request_info .http_method .value ,
@@ -610,10 +616,10 @@ def get_request_from_request_information(
610616        setattr (request , "options" , request_options )
611617
612618        if  content_length  :=  request .headers .get ("Content-Length" , None ):
613-             otel_attributes .update ({SpanAttributes . HTTP_REQUEST_CONTENT_LENGTH : content_length })
619+             otel_attributes .update ({"http.request.body.size" : content_length })
614620
615621        if  content_type  :=  request .headers .get ("Content-Type" , None ):
616-             otel_attributes .update ({"http.request_content_type " : content_type })
622+             otel_attributes .update ({"http.request.header.content-type " : content_type })
617623        attribute_span .set_attributes (otel_attributes )
618624        _get_request_span .set_attributes (otel_attributes )
619625        _get_request_span .end ()
0 commit comments