Class: Instana::Exporter::Otlp::MessagingConverter
- Inherits:
-
BaseConverter
- Object
- BaseConverter
- Instana::Exporter::Otlp::MessagingConverter
- Defined in:
- lib/instana/exporter/otlp/messaging_converter.rb
Overview
Converter for messaging spans to OTLP format
Instance Method Summary collapse
- #convert_attributes ⇒ Object
-
#span_name ⇒ String
Build OTel-compliant span name for messaging (RabbitMQ) spans.
Methods inherited from BaseConverter
Constructor Details
This class inherits a constructor from Instana::Exporter::Otlp::BaseConverter
Instance Method Details
#convert_attributes ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/instana/exporter/otlp/messaging_converter.rb', line 35 def convert_attributes attributes = {} rabbitmq_data = span[:data]&.[](:rabbitmq) if rabbitmq_data add_attribute(attributes, OpenTelemetry::SemConv::Incubating::MESSAGING::MESSAGING_SYSTEM, 'rabbitmq') add_attribute(attributes, OpenTelemetry::SemConv::Incubating::MESSAGING::MESSAGING_DESTINATION_NAME, rabbitmq_destination_name(rabbitmq_data)) add_attribute(attributes, OpenTelemetry::SemConv::Incubating::MESSAGING::MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY, rabbitmq_data[:key]) add_attribute(attributes, 'messaging.rabbitmq.queue', rabbitmq_data[:queue]) add_attribute(attributes, OpenTelemetry::SemConv::SERVER::SERVER_ADDRESS, rabbitmq_data[:address]) operation = rabbitmq_data[:sort] == 'publish' ? 'send' : 'receive' add_attribute(attributes, OpenTelemetry::SemConv::Incubating::MESSAGING::MESSAGING_OPERATION_TYPE, operation) end attributes end |
#span_name ⇒ String
Build OTel-compliant span name for messaging (RabbitMQ) spans
Formula per SPAN_NAME_PATTERNS.txt Section 3 (bunny/AMQP):
publish → "{exchange} publish" (or "{queue} publish" when no exchange)
receive → "{queue} receive"
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/instana/exporter/otlp/messaging_converter.rb', line 21 def span_name rabbitmq_data = span[:data]&.[](:rabbitmq) || {} sort = rabbitmq_data[:sort].to_s if sort == 'publish' dest = rabbitmq_data[:exchange].to_s.strip dest = rabbitmq_data[:queue].to_s.strip if dest.empty? dest.empty? ? 'publish' : "#{dest} publish" else queue = rabbitmq_data[:queue].to_s.strip queue.empty? ? 'receive' : "#{queue} receive" end end |