lib/opentelemetry/instrumentation/redis/patches/client.rb in opentelemetry-instrumentation-redis-0.20.0 vs lib/opentelemetry/instrumentation/redis/patches/client.rb in opentelemetry-instrumentation-redis-0.21.0
- old
+ new
@@ -27,14 +27,16 @@
attributes['db.redis.database_index'] = options[:db] unless options[:db].zero?
attributes['peer.service'] = config[:peer_service] if config[:peer_service]
attributes.merge!(OpenTelemetry::Instrumentation::Redis.attributes)
- parsed_commands = parse_commands(commands)
- parsed_commands = OpenTelemetry::Common::Utilities.truncate(parsed_commands, MAX_STATEMENT_LENGTH)
- parsed_commands = OpenTelemetry::Common::Utilities.utf8_encode(parsed_commands, binary: true)
- attributes['db.statement'] = parsed_commands
+ unless config[:db_statement] == :omit
+ parsed_commands = parse_commands(commands)
+ parsed_commands = OpenTelemetry::Common::Utilities.truncate(parsed_commands, MAX_STATEMENT_LENGTH)
+ parsed_commands = OpenTelemetry::Common::Utilities.utf8_encode(parsed_commands, binary: true)
+ attributes['db.statement'] = parsed_commands
+ end
span_name = if commands.length == 1
commands[0][0].to_s.upcase
else
'PIPELINED'
@@ -68,10 +70,10 @@
# we want to short circuit parsing the commands
# and return the obfuscated command
return 'AUTH ?' if command[0] == :auth
command[0] = command[0].to_s.upcase
- if config[:enable_statement_obfuscation]
+ if config[:db_statement] == :obfuscate
command[0] + ' ?' * (command.size - 1)
else
command.join(' ')
end
end.join("\n")