class ElasticAPM::Transport::Filters::HashSanitizer
@api private
def filter_key?(key)
def filter_key?(key) @key_patterns.any? { |regex| regex.match(key) } end
def initialize(key_patterns:)
def initialize(key_patterns:) @key_patterns = key_patterns end
def strip_from(obj)
def strip_from(obj) strip_from!(Util::DeepDup.dup(obj)) end
def strip_from!(obj)
def strip_from!(obj) return unless obj.is_a?(Hash) obj.each_pair do |k, v| case v when Hash strip_from!(v) else next unless filter_key?(k) obj[k] = FILTERED end end end