Class: Instana::SpanFiltering::Condition
- Inherits:
-
Object
- Object
- Instana::SpanFiltering::Condition
- Defined in:
- lib/instana/span_filtering/condition.rb
Overview
Represents a condition for filtering spans
A condition consists of:
-
key: The attribute to match against (category, kind, type, or span attribute)
-
values: List of values to match against (OR logic between values)
-
match_type: String matching strategy (strict, startswith, endswith, contains)
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#match_type ⇒ Object
readonly
Returns the value of attribute match_type.
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
-
#initialize(key, values, match_type = 'strict') ⇒ Condition
constructor
A new instance of Condition.
-
#matches?(span) ⇒ Boolean
Check if a span matches this condition.
Constructor Details
#initialize(key, values, match_type = 'strict') ⇒ Condition
Returns a new instance of Condition.
14 15 16 17 18 |
# File 'lib/instana/span_filtering/condition.rb', line 14 def initialize(key, values, match_type = 'strict') @key = key @values = Array(values) @match_type = match_type end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
12 13 14 |
# File 'lib/instana/span_filtering/condition.rb', line 12 def key @key end |
#match_type ⇒ Object (readonly)
Returns the value of attribute match_type.
12 13 14 |
# File 'lib/instana/span_filtering/condition.rb', line 12 def match_type @match_type end |
#values ⇒ Object (readonly)
Returns the value of attribute values.
12 13 14 |
# File 'lib/instana/span_filtering/condition.rb', line 12 def values @values end |
Instance Method Details
#matches?(span) ⇒ Boolean
Check if a span matches this condition
23 24 25 26 27 28 |
# File 'lib/instana/span_filtering/condition.rb', line 23 def matches?(span) attribute_value = extract_attribute(span, @key) return false if attribute_value.nil? @values.any? { |value| matches_value?(attribute_value, value) } end |