Class: ElasticAPM::Filters::Container Private

Inherits:
Object
  • Object
show all
Defined in:
lib/elastic_apm/filters.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Container

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Container.



15
16
17
18
19
20
21
# File 'lib/elastic_apm/filters.rb', line 15

def initialize(config)
  @config = config
  @filters = {
    request_body: RequestBodyFilter.new(config),
    secrets: SecretsFilter.new(config)
  }
end

Instance Attribute Details

#configObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



23
24
25
# File 'lib/elastic_apm/filters.rb', line 23

def config
  @config
end

Instance Method Details

#add(key, filter) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
# File 'lib/elastic_apm/filters.rb', line 25

def add(key, filter)
  @filters[key] = filter
end

#apply(payload) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



33
34
35
36
37
38
39
# File 'lib/elastic_apm/filters.rb', line 33

def apply(payload)
  @filters.reduce(payload) do |result, (_key, filter)|
    result = filter.call(result)
    break if result.nil?
    result
  end
end

#lengthObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



41
42
43
# File 'lib/elastic_apm/filters.rb', line 41

def length
  @filters.length
end

#remove(key) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



29
30
31
# File 'lib/elastic_apm/filters.rb', line 29

def remove(key)
  @filters.delete(key)
end