Sha256: ac5576bde5c78504d606eb29af175438aa62233964d4cd237da28c5370e48ca6

Contents?: true

Size: 816 Bytes

Versions: 5

Compression:

Stored size: 816 Bytes

Contents

# frozen_string_literal: true

require 'elastic_apm/transport/filters/secrets_filter'

module ElasticAPM
  module Transport
    # @api private
    module Filters
      def self.new(config)
        Container.new(config)
      end

      # @api private
      class Container
        def initialize(config)
          @filters = { secrets: SecretsFilter.new(config) }
        end

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

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

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

        def length
          @filters.length
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
elastic-apm-2.7.0 lib/elastic_apm/transport/filters.rb
elastic-apm-2.6.1 lib/elastic_apm/transport/filters.rb
elastic-apm-2.6.0 lib/elastic_apm/transport/filters.rb
elastic-apm-2.5.0 lib/elastic_apm/transport/filters.rb
elastic-apm-2.4.0 lib/elastic_apm/transport/filters.rb