Class: Datadog::Pipeline::SpanProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/ddtrace/pipeline/span_processor.rb

Overview

SpanProcessor

Instance Method Summary collapse

Constructor Details

#initialize(operation = nil, &block) ⇒ SpanProcessor

Returns a new instance of SpanProcessor.

Raises:

  • (ArgumentError)

5
6
7
8
9
10
11
# File 'lib/ddtrace/pipeline/span_processor.rb', line 5

def initialize(operation = nil, &block)
  callable = operation || block

  raise(ArgumentError) unless callable.respond_to?(:call)

  @operation = operation || block
end

Instance Method Details

#call(trace) ⇒ Object


13
14
15
16
17
# File 'lib/ddtrace/pipeline/span_processor.rb', line 13

def call(trace)
  trace.each do |span|
    @operation.call(span) rescue next
  end
end