Class: Datadog::Sampling::Rule
- Inherits:
-
Object
- Object
- Datadog::Sampling::Rule
- Extended by:
- Forwardable
- Defined in:
- lib/ddtrace/sampling/rule.rb
Overview
Sampling rule that dictates if a span matches a specific criteria and what sampling strategy to apply in case of a positive match.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#matcher ⇒ Object
readonly
Returns the value of attribute matcher.
-
#sampler ⇒ Object
readonly
Returns the value of attribute sampler.
Instance Method Summary collapse
-
#initialize(matcher, sampler) ⇒ Rule
constructor
A new instance of Rule.
-
#match?(span) ⇒ Boolean, NilClass
Evaluates if the provided ‘span` conforms to the `matcher`.
Constructor Details
#initialize(matcher, sampler) ⇒ Rule
Returns a new instance of Rule.
18 19 20 21 |
# File 'lib/ddtrace/sampling/rule.rb', line 18 def initialize(matcher, sampler) @matcher = matcher @sampler = sampler end |
Instance Attribute Details
#matcher ⇒ Object (readonly)
Returns the value of attribute matcher.
14 15 16 |
# File 'lib/ddtrace/sampling/rule.rb', line 14 def matcher @matcher end |
#sampler ⇒ Object (readonly)
Returns the value of attribute sampler.
14 15 16 |
# File 'lib/ddtrace/sampling/rule.rb', line 14 def sampler @sampler end |
Instance Method Details
#match?(span) ⇒ Boolean, NilClass
Evaluates if the provided ‘span` conforms to the `matcher`.
28 29 30 31 32 33 |
# File 'lib/ddtrace/sampling/rule.rb', line 28 def match?(span) @matcher.match?(span) rescue => e Datadog::Logger.log.error("Matcher failed. Cause: #{e.message} Source: #{e.backtrace.first}") nil end |