Module: OpenTelemetry::Adapters::Redis::Patches::Client

Defined in:
lib/opentelemetry/adapters/redis/patches/client.rb

Overview

Module to prepend to Redis::Client for instrumentation

Instance Method Summary collapse

Instance Method Details

#call(*args, &block) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 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) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# 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