Module: Instana::SpanFiltering
- Defined in:
- lib/instana/span_filtering.rb,
lib/instana/span_filtering/condition.rb,
lib/instana/span_filtering/filter_rule.rb,
lib/instana/span_filtering/configuration.rb
Overview
SpanFiltering module provides functionality to filter spans based on configured rules
Defined Under Namespace
Classes: Condition, Configuration, FilterRule
Class Attribute Summary collapse
-
.configuration ⇒ Object
readonly
Returns the value of attribute configuration.
Class Method Summary collapse
-
.deactivated? ⇒ Boolean
Check if span filtering is deactivated.
-
.filter_span(span) ⇒ Hash?
Check if a span should be filtered out.
-
.initialize ⇒ Configuration
Initialize the span filtering configuration.
-
.reset ⇒ Object
Reset the configuration (mainly for testing).
Class Attribute Details
.configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
13 14 15 |
# File 'lib/instana/span_filtering.rb', line 13 def configuration @configuration end |
Class Method Details
.deactivated? ⇒ Boolean
Check if span filtering is deactivated
23 24 25 |
# File 'lib/instana/span_filtering.rb', line 23 def deactivated? @configuration&.deactivated || false end |
.filter_span(span) ⇒ Hash?
Check if a span should be filtered out
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/instana/span_filtering.rb', line 30 def filter_span(span) return nil if deactivated? return nil unless @configuration # Check include rules first (whitelist) if @configuration.include_rules.any? # If we have include rules, only keep spans that match at least one include rule unless @configuration.include_rules.any? { |rule| rule.matches?(span) } return { filtered: true, suppression: false } end # If it matches an include rule, continue to exclude rules end # Check exclude rules (blacklist) @configuration.exclude_rules.each do |rule| if rule.matches?(span) return { filtered: true, suppression: rule.suppression } end end nil # Keep the span if no rules match end |
.initialize ⇒ Configuration
Initialize the span filtering configuration
17 18 19 |
# File 'lib/instana/span_filtering.rb', line 17 def initialize @configuration = Configuration.new end |
.reset ⇒ Object
Reset the configuration (mainly for testing)
54 55 56 |
# File 'lib/instana/span_filtering.rb', line 54 def reset @configuration = nil end |