Class: Datadog::Sampling::SimpleMatcher
- Defined in:
- lib/ddtrace/sampling/matcher.rb
Overview
A Matcher that supports matching a span by operation name and/or service name.
Constant Summary collapse
- MATCH_ALL =
Returns ‘true` for case equality (===) with any object
Class.new do # DEV: A class that implements `#===` is ~20% faster than # DEV: a `Proc` that always returns `true`. def ===(other) true end end.new
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
Instance Method Summary collapse
-
#initialize(name: MATCH_ALL, service: MATCH_ALL) ⇒ SimpleMatcher
constructor
A new instance of SimpleMatcher.
- #match?(span) ⇒ Boolean
Constructor Details
#initialize(name: MATCH_ALL, service: MATCH_ALL) ⇒ SimpleMatcher
Returns a new instance of SimpleMatcher.
31 32 33 34 |
# File 'lib/ddtrace/sampling/matcher.rb', line 31 def initialize(name: MATCH_ALL, service: MATCH_ALL) @name = name @service = service end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
27 28 29 |
# File 'lib/ddtrace/sampling/matcher.rb', line 27 def name @name end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
27 28 29 |
# File 'lib/ddtrace/sampling/matcher.rb', line 27 def service @service end |
Instance Method Details
#match?(span) ⇒ Boolean
36 37 38 |
# File 'lib/ddtrace/sampling/matcher.rb', line 36 def match?(span) name === span.name && service === span.service end |