Bases: BaseNatsTelemetrySettingsProvider[list['Msg']]
Source code in faststream/nats/opentelemetry/provider.py
| def __init__(self) -> None:
self.messaging_system = "nats"
|
messaging_system instance-attribute
messaging_system = 'nats'
get_consume_attrs_from_message
get_consume_attrs_from_message(
msg: StreamMessage[list[Msg]],
) -> dict[str, Any]
Source code in faststream/nats/opentelemetry/provider.py
69
70
71
72
73
74
75
76
77
78
79
80 | def get_consume_attrs_from_message(
self,
msg: "StreamMessage[list[Msg]]",
) -> dict[str, Any]:
return {
SpanAttributes.MESSAGING_SYSTEM: self.messaging_system,
SpanAttributes.MESSAGING_MESSAGE_ID: msg.message_id,
SpanAttributes.MESSAGING_MESSAGE_CONVERSATION_ID: msg.correlation_id,
SpanAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES: len(msg.body),
SpanAttributes.MESSAGING_BATCH_MESSAGE_COUNT: len(msg.raw_message),
MESSAGING_DESTINATION_PUBLISH_NAME: msg.raw_message[0].subject,
}
|
get_consume_destination_name
get_consume_destination_name(
msg: StreamMessage[list[Msg]],
) -> str
Source code in faststream/nats/opentelemetry/provider.py
| @override
def get_consume_destination_name(
self,
msg: "StreamMessage[list[Msg]]",
) -> str:
return msg.raw_message[0].subject
|
get_publish_attrs_from_cmd
Source code in faststream/nats/opentelemetry/provider.py
23
24
25
26
27
28
29
30
31 | def get_publish_attrs_from_cmd(
self,
cmd: "PublishCommand",
) -> dict[str, Any]:
return {
SpanAttributes.MESSAGING_SYSTEM: self.messaging_system,
SpanAttributes.MESSAGING_DESTINATION_NAME: cmd.destination,
SpanAttributes.MESSAGING_MESSAGE_CONVERSATION_ID: cmd.correlation_id,
}
|
get_publish_destination_name
Source code in faststream/nats/opentelemetry/provider.py
| @override
def get_publish_destination_name(
self,
cmd: "PublishCommand",
) -> str:
return cmd.destination
|