Class: Datadog::Sampling::ProcMatcher

Inherits:
Matcher
  • Object
show all
Defined in:
lib/ddtrace/sampling/matcher.rb

Overview

A Matcher that allows for arbitrary span matching based on the return value of a provided block.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|name, service| ... } ⇒ ProcMatcher

Returns a new instance of ProcMatcher.

Yields:

  • (name, service)

    Provides span name and service to the block

Yield Returns:

  • (Boolean)

    Whether the span conforms to this matcher



48
49
50
# File 'lib/ddtrace/sampling/matcher.rb', line 48

def initialize(&block)
  @block = block
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



44
45
46
# File 'lib/ddtrace/sampling/matcher.rb', line 44

def block
  @block
end

Instance Method Details

#match?(span) ⇒ Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/ddtrace/sampling/matcher.rb', line 52

def match?(span)
  block.call(span.name, span.service)
end