Module: Datadog::Contrib::Redis::Quantize
- Defined in:
- lib/ddtrace/contrib/redis/quantize.rb
Overview
Quantize contains Redis-specific resource quantization tools.
Constant Summary collapse
- PLACEHOLDER =
'?'.freeze
- TOO_LONG_MARK =
'...'.freeze
- VALUE_MAX_LEN =
100- CMD_MAX_LEN =
1000
Class Method Summary collapse
Class Method Details
.format_arg(arg) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/ddtrace/contrib/redis/quantize.rb', line 13 def format_arg(arg) a = arg.to_s a = a[0..(VALUE_MAX_LEN - TOO_LONG_MARK.length - 1)] + TOO_LONG_MARK if a.length > VALUE_MAX_LEN a rescue StandardError => e Datadog::Tracer.log.debug("non formattable Redis arg #{a}: #{e}") PLACEHOLDER end |
.format_command_args(command_args) ⇒ Object
22 23 24 25 26 |
# File 'lib/ddtrace/contrib/redis/quantize.rb', line 22 def format_command_args(command_args) cmd = command_args.map { |x| format_arg(x) }.join(' ') cmd = cmd[0..(CMD_MAX_LEN - TOO_LONG_MARK.length - 1)] + TOO_LONG_MARK if cmd.length > CMD_MAX_LEN cmd end |