Bases: TelemetrySettingsProvider[dict[str, Any]]
Source code in faststream/redis/opentelemetry/provider.py
| def __init__(self) -> None:
self.messaging_system = "redis"
|
messaging_system
instance-attribute
messaging_system = 'redis'
get_consume_attrs_from_message
get_consume_attrs_from_message(msg)
Source code in faststream/redis/opentelemetry/provider.py
| def get_consume_attrs_from_message(
self,
msg: "StreamMessage[dict[str, Any]]",
) -> dict[str, Any]:
attrs = {
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),
MESSAGING_DESTINATION_PUBLISH_NAME: msg.raw_message["channel"],
}
if cast("str", msg.raw_message.get("type", "")).startswith("b"):
attrs[SpanAttributes.MESSAGING_BATCH_MESSAGE_COUNT] = len(
msg.raw_message["data"],
)
return attrs
|
get_consume_destination_name
get_consume_destination_name(msg)
Source code in faststream/redis/opentelemetry/provider.py
| def get_consume_destination_name(
self,
msg: "StreamMessage[dict[str, Any]]",
) -> str:
return self._get_destination(msg.raw_message)
|
get_publish_attrs_from_cmd
get_publish_attrs_from_cmd(cmd)
Source code in faststream/redis/opentelemetry/provider.py
| 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
get_publish_destination_name(cmd)
Source code in faststream/redis/opentelemetry/provider.py
| def get_publish_destination_name(
self,
cmd: "PublishCommand",
) -> str:
return cmd.destination
|