Sha256: a2a9bbcb6b1ab549dc743ff3e80a5fb34f133c9313416deee68e42df93c73419

Contents?: true

Size: 1.02 KB

Versions: 17

Compression:

Stored size: 1.02 KB

Contents

# encoding: utf-8


require 'ting_yun/agent/datastores/mongo/obfuscator'

module TingYun
  module Instrumentation
    module Support
      module MongoFormatter

        PLAINTEXT_KEYS = [
            :database,
            :collection,
            :operation,
            :fields,
            :skip,
            :limit,
            :order
        ]

        OBFUSCATE_KEYS = [
            :selector
        ]

        def self.format(statement, operation)

          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)
          statement
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
tingyun_rpm-3.2.0 lib/ting_yun/instrumentation/support/mongo_formatter.rb
tingyun_rpm-1.6.1 lib/ting_yun/instrumentation/support/mongo_formatter.rb
tingyun_rpm-1.5.0 lib/ting_yun/instrumentation/support/mongo_formatter.rb
tingyun_rpm-1.4.2 lib/ting_yun/instrumentation/support/mongo_formatter.rb
tingyun_rpm-1.4.1 lib/ting_yun/instrumentation/support/mongo_formatter.rb
tingyun_rpm-1.3.1 lib/ting_yun/instrumentation/support/mongo_formatter.rb
tingyun_rpm-1.3.0 lib/ting_yun/instrumentation/support/mongo_formatter.rb
tingyun_rpm-1.2.0 lib/ting_yun/instrumentation/support/mongo_formatter.rb
tingyun_rpm-1.1.4.2 lib/ting_yun/instrumentation/support/mongo_formatter.rb
tingyun_rpm-1.1.4.1 lib/ting_yun/instrumentation/support/mongo_formatter.rb
tingyun_rpm-1.1.4 lib/ting_yun/instrumentation/support/mongo_formatter.rb
tingyun_rpm-1.1.3 lib/ting_yun/instrumentation/support/mongo_formatter.rb
tingyun_rpm-1.1.2 lib/ting_yun/instrumentation/support/mongo_formatter.rb
tingyun_rpm-1.1.1 lib/ting_yun/instrumentation/support/mongo_formatter.rb
tingyun_rpm-1.1.0 lib/ting_yun/instrumentation/support/mongo_formatter.rb
tingyun_rpm-1.0.7 lib/ting_yun/instrumentation/support/mongo_formatter.rb
tingyun_rpm-1.0.6 lib/ting_yun/instrumentation/support/mongo_formatter.rb