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



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

def initialize(&block)
  @block = block
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



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

def block
  @block
end

Instance Method Details

#match?(span) ⇒ Boolean

Returns:

  • (Boolean)


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

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