Sha256: 6d9dae3b8a13eff78127c5e3e23bf25f67a91a065f388ac3706f371b9cef590f

Contents?: true

Size: 810 Bytes

Versions: 3

Compression:

Stored size: 810 Bytes

Contents

# frozen_string_literal: true

module OpenTracing
  module Instrumentation
    module Mongo
      # SampleSafetyArgumentChecker check argument to safety
      # Draft implementation
      class SampleSafetyArgumentChecker
        DEFAULT_SAFE_ARGUMENTS = [
          '$readPreference',
          '$clusterTime',
        ].freeze

        attr_reader :safe_arguments

        def initialize(safe_arguments: DEFAULT_SAFE_ARGUMENTS)
          @safe_arguments = safe_arguments
        end

        # check
        #
        # @return (TrueClass, FalseClass) `true`, if argument safe and not
        # not should be cleaned. Otherwise return `false``.
        def argument_safe?(_command_name, argument_path, _argument_value)
          safe_arguments.include?(argument_path)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
opentracing-instrumentation-0.2.1 lib/opentracing/instrumentation/mongo/sample_safety_argument_checker.rb
opentracing-instrumentation-0.2.0 lib/opentracing/instrumentation/mongo/sample_safety_argument_checker.rb
opentracing-instrumentation-0.1.18 lib/opentracing/instrumentation/mongo/sample_safety_argument_checker.rb