Class: OpenTracing::Instrumentation::Mongo::SampleSafetyArgumentChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/opentracing/instrumentation/mongo/sample_safety_argument_checker.rb

Overview

SampleSafetyArgumentChecker check argument to safety Draft implementation

Constant Summary collapse

DEFAULT_SAFE_ARGUMENTS =
[
  '$readPreference',
  '$clusterTime',
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(safe_arguments: DEFAULT_SAFE_ARGUMENTS) ⇒ SampleSafetyArgumentChecker

Returns a new instance of SampleSafetyArgumentChecker.



16
17
18
# File 'lib/opentracing/instrumentation/mongo/sample_safety_argument_checker.rb', line 16

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

Instance Attribute Details

#safe_argumentsObject (readonly)

Returns the value of attribute safe_arguments.



14
15
16
# File 'lib/opentracing/instrumentation/mongo/sample_safety_argument_checker.rb', line 14

def safe_arguments
  @safe_arguments
end

Instance Method Details

#argument_safe?(_command_name, argument_path, _argument_value) ⇒ TrueClass, FalseClass

check

not should be cleaned. Otherwise return ‘false“.

Returns:

  • (TrueClass, FalseClass)

    ‘true`, if argument safe and not



24
25
26
# File 'lib/opentracing/instrumentation/mongo/sample_safety_argument_checker.rb', line 24

def argument_safe?(_command_name, argument_path, _argument_value)
  safe_arguments.include?(argument_path)
end