Sha256: fe0e3fa03fe5e98633abdc58f43d0e6b7d010e4f5da4522792be8f6d48fceca7
Contents?: true
Size: 1.21 KB
Versions: 33
Compression:
Stored size: 1.21 KB
Contents
# encoding: utf-8 require 'one_apm/agent/datastore/mongo/obfuscator' module OneApm module Agent module Datastore module Mongo module StatementFormatter PLAINTEXT_KEYS = [ :database, :collection, :operation, :fields, :skip, :limit, :order ] OBFUSCATE_KEYS = [ :selector ] def self.format(statement, operation) return nil unless OneApm::Manager.config[:'mongo.capture_queries'] result = { :operation => operation } PLAINTEXT_KEYS.each do |key| result[key] = statement[key] if statement.key?(key) end OBFUSCATE_KEYS.each do |key| if statement.key?(key) && statement[key] obfuscated = obfuscate(statement[key]) result[key] = obfuscated if obfuscated end end result end def self.obfuscate(statement) statement = Obfuscator.obfuscate_statement(statement) if OneApm::Manager.config[:'mongo.obfuscate_queries'] statement end end end end end end
Version data entries
33 entries across 33 versions & 1 rubygems