Module: Datadog::Tracing::Contrib::ActionCable::Instrumentation::ActionCableChannel

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

Overview

Instrumentation for when a Channel is subscribed to/unsubscribed from.

Defined Under Namespace

Classes: Tracer

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/datadog/tracing/contrib/action_cable/instrumentation.rb', line 36

def self.included(base)
  base.class_eval do
    set_callback(
      :subscribe,
      :around,
      ->(channel, block) { Tracer.trace(channel, :subscribe, &block) },
      prepend: true
    )

    set_callback(
      :unsubscribe,
      :around,
      ->(channel, block) { Tracer.trace(channel, :unsubscribe, &block) },
      prepend: true
    )
  end
end