Module: NewRelic::Agent::Datastores::Mongo::EventFormatter
- Defined in:
- lib/new_relic/agent/datastores/mongo/event_formatter.rb
Constant Summary collapse
- OBFUSCATE_KEYS =
Keys that will get their values replaced with ‘?’.
%w[filter query pipeline].freeze
- DENYLISTED_KEYS =
Keys that will get completely removed from the statement.
%w[deletes documents updates].freeze
Class Method Summary collapse
Class Method Details
.format(command_name, database_name, command) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/new_relic/agent/datastores/mongo/event_formatter.rb', line 18 def self.format(command_name, database_name, command) return nil unless NewRelic::Agent.config[:'mongo.capture_queries'] result = { :operation => command_name, :database => database_name, :collection => command.values.first } command.each do |key, value| next if DENYLISTED_KEYS.include?(key) if OBFUSCATE_KEYS.include?(key) = obfuscate(value) result[key] = if else result[key] = value end end result end |
.obfuscate(statement) ⇒ Object
40 41 42 43 44 45 |
# File 'lib/new_relic/agent/datastores/mongo/event_formatter.rb', line 40 def self.obfuscate(statement) if NewRelic::Agent.config[:'mongo.obfuscate_queries'] statement = NewRelic::Agent::Datastores::NosqlObfuscator.obfuscate_statement(statement) end statement end |