Module: Datadog::Tracing::Contrib::Redis::Instrumentation::InstanceMethods

Defined in:
lib/datadog/tracing/contrib/redis/instrumentation.rb

Overview

InstanceMethods - implementing instrumentation

Instance Method Summary collapse

Instance Method Details

#call(*args, &block) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/datadog/tracing/contrib/redis/instrumentation.rb', line 19

def call(*args, &block)
  show_command_args = command_args?

  Tracing.trace(Contrib::Redis::Ext::SPAN_COMMAND) do |span|
    span.service = service_name
    span.span_type = Contrib::Redis::Ext::TYPE
    span.resource = get_command(args, show_command_args)
    Contrib::Redis::Tags.set_common_tags(self, span, show_command_args)

    super
  end
end

#call_pipeline(*args, &block) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/datadog/tracing/contrib/redis/instrumentation.rb', line 32

def call_pipeline(*args, &block)
  show_command_args = command_args?

  Tracing.trace(Contrib::Redis::Ext::SPAN_COMMAND) do |span|
    span.service = service_name
    span.span_type = Contrib::Redis::Ext::TYPE
    commands = get_pipeline_commands(args, show_command_args)
    span.resource = commands.any? ? commands.join("\n") : '(none)'
    span.set_metric Contrib::Redis::Ext::METRIC_PIPELINE_LEN, commands.length
    Contrib::Redis::Tags.set_common_tags(self, span, show_command_args)

    super
  end
end