Module: OneApm::Agent::Datastore::Mongo::StatementFormatter
- Defined in:
- lib/one_apm/agent/datastore/mongo/statement_formatter.rb
Constant Summary collapse
- OA_PLAINTEXT_KEYS =
[ :database, :collection, :operation, :fields, :skip, :limit, :order ]
- OA_OBFUSCATE_KEYS =
[ :selector ]
Class Method Summary collapse
Class Method Details
.format(statement, operation) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/one_apm/agent/datastore/mongo/statement_formatter.rb', line 25 def self.format(statement, operation) return nil unless OneApm::Manager.config[:'mongo.capture_queries'] result = { :operation => operation } OA_PLAINTEXT_KEYS.each do |key| result[key] = statement[key] if statement.key?(key) end OA_OBFUSCATE_KEYS.each do |key| if statement.key?(key) && statement[key] = obfuscate(statement[key]) result[key] = if end end result end |
.obfuscate(statement) ⇒ Object
43 44 45 46 |
# File 'lib/one_apm/agent/datastore/mongo/statement_formatter.rb', line 43 def self.obfuscate(statement) statement = Obfuscator.obfuscate_statement(statement) if OneApm::Manager.config[:'mongo.obfuscate_queries'] statement end |