Class: Datadog::Tracing::Sampling::ProcMatcher

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

Overview

A Matcher that allows for arbitrary trace 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 trace name and service to the block

Yield Returns:

  • (Boolean)

    Whether the trace conforms to this matcher



55
56
57
58
# File 'lib/datadog/tracing/sampling/matcher.rb', line 55

def initialize(&block)
  super()
  @block = block
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



51
52
53
# File 'lib/datadog/tracing/sampling/matcher.rb', line 51

def block
  @block
end

Instance Method Details

#match?(trace) ⇒ Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/datadog/tracing/sampling/matcher.rb', line 60

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