Class: HeliosProcessor

Inherits:
OpenTelemetry::SDK::Trace::Export::BatchSpanProcessor
  • Object
show all
Defined in:
lib/helios/opentelemetry/sdk/helios_processor.rb

Instance Method Summary collapse

Constructor Details

#initialize(exporter, metadata_only = False) ⇒ HeliosProcessor

Returns a new instance of HeliosProcessor.



15
16
17
18
# File 'lib/helios/opentelemetry/sdk/helios_processor.rb', line 15

def initialize(exporter,  = False)
  @metadata_only = 
  super(exporter)
end

Instance Method Details

#on_finish(span) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/helios/opentelemetry/sdk/helios_processor.rb', line 29

def on_finish(span)
  if @metadata_only
    new_attributes = span.attributes.dup.reject { |k, _| ATTRIBUTES_TO_DROP.include?(k) }
    span.instance_variable_set(:@attributes, new_attributes)
  end

  super(span)
end

#on_start(span, parent_context) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/helios/opentelemetry/sdk/helios_processor.rb', line 20

def on_start(span, parent_context)
  baggage = ::OpenTelemetry::Baggage.values(context: parent_context)
  return unless baggage.key?(HELIOS_TEST_TRIGGERED_TRACE)

  span.set_attribute(HELIOS_TEST_TRIGGERED_TRACE, 'true')

  super(span, parent_context)
end