lib/opentelemetry/instrumentation/redis/patches/client.rb in opentelemetry-instrumentation-redis-0.18.0 vs lib/opentelemetry/instrumentation/redis/patches/client.rb in opentelemetry-instrumentation-redis-0.19.0
- old
+ new
@@ -11,10 +11,12 @@
# Module to prepend to Redis::Client for instrumentation
module Client
MAX_STATEMENT_LENGTH = 500
private_constant :MAX_STATEMENT_LENGTH
- def process(commands) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
+ def process(commands) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
+ return super unless config[:trace_root_spans] || OpenTelemetry::Trace.current_span.context.valid?
+
host = options[:host]
port = options[:port]
attributes = {
'db.system' => 'redis',