55from faststream .opentelemetry .middleware import TelemetryMiddleware
66from faststream .types import AnyDict
77from opentelemetry .metrics import Meter , MeterProvider
8+ from opentelemetry .semconv ._incubating .attributes import messaging_attributes # noqa: PLC2701
89from opentelemetry .semconv .trace import SpanAttributes
910from opentelemetry .trace import TracerProvider
1011
@@ -16,9 +17,9 @@ class StompTelemetrySettingsProvider(TelemetrySettingsProvider[stompman.MessageF
1617
1718 def get_consume_attrs_from_message (self , msg : StreamMessage [stompman .MessageFrame ]) -> "AnyDict" :
1819 return {
19- SpanAttributes .MESSAGING_SYSTEM : self .messaging_system ,
20- SpanAttributes .MESSAGING_MESSAGE_ID : msg .message_id ,
21- SpanAttributes .MESSAGING_MESSAGE_CONVERSATION_ID : msg .correlation_id ,
20+ messaging_attributes .MESSAGING_SYSTEM : self .messaging_system ,
21+ messaging_attributes .MESSAGING_MESSAGE_ID : msg .message_id ,
22+ messaging_attributes .MESSAGING_MESSAGE_CONVERSATION_ID : msg .correlation_id ,
2223 SpanAttributes .MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES : len (msg .body ),
2324 MESSAGING_DESTINATION_PUBLISH_NAME : msg .raw_message .headers ["destination" ],
2425 }
@@ -28,11 +29,11 @@ def get_consume_destination_name(self, msg: StreamMessage[stompman.MessageFrame]
2829
2930 def get_publish_attrs_from_kwargs (self , kwargs : StompProducerPublishKwargs ) -> AnyDict : # type: ignore[override]
3031 publish_attrs = {
31- SpanAttributes .MESSAGING_SYSTEM : self .messaging_system ,
32- SpanAttributes .MESSAGING_DESTINATION_NAME : kwargs ["destination" ],
32+ messaging_attributes .MESSAGING_SYSTEM : self .messaging_system ,
33+ messaging_attributes .MESSAGING_DESTINATION_NAME : kwargs ["destination" ],
3334 }
3435 if kwargs ["correlation_id" ]:
35- publish_attrs [SpanAttributes .MESSAGING_MESSAGE_CONVERSATION_ID ] = kwargs ["correlation_id" ]
36+ publish_attrs [messaging_attributes .MESSAGING_MESSAGE_CONVERSATION_ID ] = kwargs ["correlation_id" ]
3637 return publish_attrs
3738
3839 def get_publish_destination_name (self , kwargs : StompProducerPublishKwargs ) -> str : # type: ignore[override] # noqa: PLR6301
0 commit comments