Sha256: 370361966391675a8711d79081ddc106a9cc14a0083253c37a4b9ec93d1fffde
Contents?: true
Size: 1.2 KB
Versions: 11
Compression:
Stored size: 1.2 KB
Contents
# encoding: utf-8 # This file is distributed under New Relic's license terms. # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details. module NewRelic module Agent module Datastores module Mongo module Obfuscator ALLOWLIST = [:operation].freeze def self.obfuscate_statement(source, allowlist = ALLOWLIST) if source.is_a? Hash obfuscated = {} source.each do |key, value| if allowlist.include?(key) obfuscated[key] = value else obfuscated[key] = obfuscate_value(value, allowlist) end end obfuscated else obfuscate_value(source, allowlist) end end QUESTION_MARK = '?'.freeze def self.obfuscate_value(value, allowlist = ALLOWLIST) if value.is_a?(Hash) obfuscate_statement(value, allowlist) elsif value.is_a?(Array) value.map {|v| obfuscate_value(v, allowlist)} else QUESTION_MARK end end end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems