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



77
78
79
80
# File 'lib/datadog/tracing/sampling/matcher.rb', line 77

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

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



73
74
75
# File 'lib/datadog/tracing/sampling/matcher.rb', line 73

def block
  @block
end

Instance Method Details

#match?(trace) ⇒ Boolean

Returns:

  • (Boolean)


82
83
84
# File 'lib/datadog/tracing/sampling/matcher.rb', line 82

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