Class: Datadog::Tracing::Sampling::SimpleMatcher
- Defined in:
- lib/datadog/tracing/sampling/matcher.rb
Overview
A Sampling::Matcher that supports matching a trace by trace 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.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Instance Method Summary collapse
-
#initialize(name: MATCH_ALL, service: MATCH_ALL, resource: MATCH_ALL, tags: {}) ⇒ SimpleMatcher
constructor
A new instance of SimpleMatcher.
- #match?(trace) ⇒ Boolean
Constructor Details
#initialize(name: MATCH_ALL, service: MATCH_ALL, resource: MATCH_ALL, tags: {}) ⇒ SimpleMatcher
Returns a new instance of SimpleMatcher.
40 41 42 43 44 45 46 |
# File 'lib/datadog/tracing/sampling/matcher.rb', line 40 def initialize(name: MATCH_ALL, service: MATCH_ALL, resource: MATCH_ALL, tags: {}) super() @name = name @service = service @resource = resource @tags = end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
32 33 34 |
# File 'lib/datadog/tracing/sampling/matcher.rb', line 32 def name @name end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
32 33 34 |
# File 'lib/datadog/tracing/sampling/matcher.rb', line 32 def resource @resource end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
32 33 34 |
# File 'lib/datadog/tracing/sampling/matcher.rb', line 32 def service @service end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
32 33 34 |
# File 'lib/datadog/tracing/sampling/matcher.rb', line 32 def @tags end |
Instance Method Details
#match?(trace) ⇒ Boolean
48 49 50 |
# File 'lib/datadog/tracing/sampling/matcher.rb', line 48 def match?(trace) name === trace.name && service === trace.service && resource === trace.resource && (trace) end |