module OpenTelemetry::Adapters::Redis::Patches::Client
Module to prepend to Redis::Client for instrumentation
Public Instance Methods
call(*args, &block)
click to toggle source
Calls superclass method
# File lib/opentelemetry/adapters/redis/patches/client.rb, line 13 def call(*args, &block) response = nil tracer.in_span( Utils.format_command(args), attributes: client_attributes.merge( 'db.statement' => Utils.format_statement(args) ), kind: :client ) do response = super(*args, &block) end response end
call_pipeline(*args, &block)
click to toggle source
Calls superclass method
# File lib/opentelemetry/adapters/redis/patches/client.rb, line 29 def call_pipeline(*args, &block) response = nil tracer.in_span( 'pipeline', attributes: client_attributes.merge( 'db.statement' => Utils.format_pipeline_statement(args) ), kind: :client ) do response = super(*args, &block) end response end
Private Instance Methods
client_attributes()
click to toggle source
# File lib/opentelemetry/adapters/redis/patches/client.rb, line 47 def client_attributes host = options[:host] port = options[:port] { 'component' => 'redis', 'db.type' => 'redis', 'db.instance' => options[:db].to_s, 'db.url' => "redis://#{host}:#{port}", 'net.peer.name' => host, 'net.peer.port' => port } end
tracer()
click to toggle source
# File lib/opentelemetry/adapters/redis/patches/client.rb, line 61 def tracer Redis::Adapter.instance.tracer end