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



57
58
59
60
# File 'lib/datadog/tracing/sampling/matcher.rb', line 57

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

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



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

def block
  @block
end

Instance Method Details

#match?(trace) ⇒ Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/datadog/tracing/sampling/matcher.rb', line 62

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