Method: Datadog::Contrib::Redis::Quantize.format_arg

Defined in:
lib/ddtrace/contrib/redis/quantize.rb

.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)
  str = arg.is_a?(Symbol) ? arg.to_s.upcase : arg.to_s
  str = Utils.utf8_encode(str, binary: true, placeholder: PLACEHOLDER)
  Utils.truncate(str, VALUE_MAX_LEN, TOO_LONG_MARK)
rescue => e
  Datadog.logger.debug("non formattable Redis arg #{str}: #{e}")
  PLACEHOLDER
end