lib/opentelemetry/instrumentation/redis/utils.rb in opentelemetry-instrumentation-redis-0.15.0 vs lib/opentelemetry/instrumentation/redis/utils.rb in opentelemetry-instrumentation-redis-0.16.0

- old
+ new

@@ -28,17 +28,17 @@ def format_statement(command_args) command_args = resolve_command_args(command_args) return 'AUTH ?' if auth_command?(command_args) cmd = command_args.map { |x| format_arg(x) }.join(' ') - truncate(cmd, CMD_MAX_LEN) + OpenTelemetry::Common::Utilities.truncate(cmd, CMD_MAX_LEN) end def format_arg(arg) str = arg.is_a?(Symbol) ? arg.to_s.upcase : arg.to_s str = OpenTelemetry::Common::Utilities.utf8_encode(str, binary: true) - truncate(str, VALUE_MAX_LEN) + OpenTelemetry::Common::Utilities.truncate(str, VALUE_MAX_LEN) rescue StandardError => e OpenTelemetry.logger.debug("non formattable Redis arg #{str}: #{e}") PLACEHOLDER end @@ -52,13 +52,9 @@ # redis.call([:cmd, 'arg1', ...]) def resolve_command_args(command_args) return command_args.first if command_args.is_a?(Array) && command_args.first.is_a?(Array) command_args - end - - def truncate(string, size) - string.size > size ? "#{string[0...size - 3]}..." : string end end end end end