Class: Instana::Exporter::Otlp::RpcConverter

Inherits:
BaseConverter show all
Defined in:
lib/instana/exporter/otlp/rpc_converter.rb

Overview

Converter for RPC spans (gRPC, ActionCable) to OTLP format

Instance Method Summary collapse

Methods inherited from BaseConverter

#convert, #initialize

Constructor Details

This class inherits a constructor from Instana::Exporter::Otlp::BaseConverter

Instance Method Details

#convert_attributesObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/instana/exporter/otlp/rpc_converter.rb', line 33

def convert_attributes
  attributes = {}

  rpc_data = span[:data]&.[](:rpc)
  return attributes unless rpc_data

  # Check if this is an ActionCable span
  if rpc_data[:flavor] == :actioncable
    convert_action_cable_attributes(attributes, rpc_data)
  else
    convert_grpc_attributes(attributes, rpc_data)
  end

  attributes
end

#span_nameString

Build OTel-compliant span name for RPC spans

Formulas per SPAN_NAME_PATTERNS.txt Section 4:

gRPC        → "{package.Service/Method}"  (leading "/" stripped per OTel spec)
ActionCable → "{ChannelClass#action}"      (call string used as-is)

Returns:

  • (String)

    The span name



22
23
24
25
26
27
28
29
30
31
# File 'lib/instana/exporter/otlp/rpc_converter.rb', line 22

def span_name
  rpc_data = span[:data]&.[](:rpc) || {}

  if rpc_data[:flavor] == :actioncable
    rpc_data[:call].to_s
  else
    # Strip the mandatory leading slash per gRPC/OTel spec
    rpc_data[:call].to_s.delete_prefix('/')
  end.then { |n| n.empty? ? super : n }
end