Class: OpenTracing::Instrumentation::Mongo::QuerySanitazer
- Inherits:
-
DirectSanitazer
- Object
- DirectSanitazer
- OpenTracing::Instrumentation::Mongo::QuerySanitazer
- Defined in:
- lib/opentracing/instrumentation/mongo/query_sanitazer.rb
Overview
QuerySanitazer clean private data from requests.
Defined Under Namespace
Classes: ArrayItemPlaceholder
Constant Summary collapse
- DEFAULT_SAFE_CLASSES =
[ TrueClass, FalseClass, Numeric, Date, Time, ].freeze
- DEFAULT_EXCLUDE_KEYS =
%w[lsid].freeze
Instance Method Summary collapse
-
#initialize(safety_argument_checker: SampleSafetyArgumentChecker.new, safe_classes: DEFAULT_SAFE_CLASSES, max_array_size: 4, exclude_keys: DEFAULT_EXCLUDE_KEYS) ⇒ QuerySanitazer
constructor
A new instance of QuerySanitazer.
- #sanitaze(command, command_name) ⇒ Object
Constructor Details
#initialize(safety_argument_checker: SampleSafetyArgumentChecker.new, safe_classes: DEFAULT_SAFE_CLASSES, max_array_size: 4, exclude_keys: DEFAULT_EXCLUDE_KEYS) ⇒ QuerySanitazer
Returns a new instance of QuerySanitazer.
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/opentracing/instrumentation/mongo/query_sanitazer.rb', line 21 def initialize( safety_argument_checker: SampleSafetyArgumentChecker.new, safe_classes: DEFAULT_SAFE_CLASSES, max_array_size: 4, exclude_keys: DEFAULT_EXCLUDE_KEYS ) super() @safety_argument_checker = safety_argument_checker @safe_classes = safe_classes @max_array_size = max_array_size @exclude_keys = exclude_keys end |
Instance Method Details
#sanitaze(command, command_name) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/opentracing/instrumentation/mongo/query_sanitazer.rb', line 34 def sanitaze(command, command_name) command_without_command_name = super(command, command_name) exclude_keys.each do |key| command_without_command_name.delete(key) end sanitaze_value(command_without_command_name) end |