Class: Instana::Exporter::Otlp::CustomConverter
- Inherits:
-
BaseConverter
- Object
- BaseConverter
- Instana::Exporter::Otlp::CustomConverter
- Defined in:
- lib/instana/exporter/otlp/custom_converter.rb
Overview
Converter for Instana SDK custom spans to OTLP format
Instance Method Summary collapse
- #convert_attributes ⇒ Object
-
#span_name ⇒ String
Build OTel-compliant span name for custom (SDK) spans.
Methods inherited from BaseConverter
Constructor Details
This class inherits a constructor from Instana::Exporter::Otlp::BaseConverter
Instance Method Details
#convert_attributes ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/instana/exporter/otlp/custom_converter.rb', line 22 def convert_attributes attributes = {} sdk_data = span[:data]&.[](:sdk) || {} # Add standard Instana attributes add_attribute(attributes, 'instana.span.type', 'custom') add_attribute(attributes, 'instana.sdk.name', sdk_data[:name] || span[:n]) add_attribute(attributes, 'instana.sdk.type', sdk_data[:type]) # Add tags directly = sdk_data.dig(:custom, :tags) || {} .each do |key, value| attributes[key] = value end attributes end |
#span_name ⇒ String
Build OTel-compliant span name for custom (SDK) spans
Formula per SPAN_NAME_PATTERNS.txt Section 7:
Use the user-supplied sdk[:name] when available, otherwise fall back
to the internal span type key (span[:n]).
17 18 19 20 |
# File 'lib/instana/exporter/otlp/custom_converter.rb', line 17 def span_name sdk_name = span[:data]&.[](:sdk)&.[](:name).to_s.strip sdk_name.empty? ? super : sdk_name end |