lib/opentelemetry/instrumentation/redis/patches/client.rb in opentelemetry-instrumentation-redis-0.8.0 vs lib/opentelemetry/instrumentation/redis/patches/client.rb in opentelemetry-instrumentation-redis-0.9.0
- old
+ new
@@ -11,15 +11,15 @@
# Module to prepend to Redis::Client for instrumentation
module Client
def call(*args, &block)
response = nil
+ attributes = client_attributes
+ attributes['db.statement'] = Utils.format_statement(args)
tracer.in_span(
Utils.format_command(args),
- attributes: client_attributes.merge(
- 'db.statement' => Utils.format_statement(args)
- ),
+ attributes: attributes,
kind: :client
) do
response = super(*args, &block)
end
@@ -27,15 +27,15 @@
end
def call_pipeline(*args, &block)
response = nil
+ attributes = client_attributes
+ attributes['db.statement'] = Utils.format_pipeline_statement(args)
tracer.in_span(
'pipeline',
- attributes: client_attributes.merge(
- 'db.statement' => Utils.format_pipeline_statement(args)
- ),
+ attributes: attributes,
kind: :client
) do
response = super(*args, &block)
end
@@ -46,16 +46,16 @@
def client_attributes
host = options[:host]
port = options[:port]
- {
+ OpenTelemetry::Instrumentation::Redis.attributes.merge(
'db.type' => 'redis',
'db.instance' => options[:db].to_s,
'db.url' => "redis://#{host}:#{port}",
'net.peer.name' => host,
'net.peer.port' => port
- }
+ )
end
def tracer
Redis::Instrumentation.instance.tracer
end