Module: Datadog::Tracing::Contrib::ActionCable::Instrumentation::ActionCableConnection

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

Overview

When a new WebSocket is open, we receive a Rack request resource name “GET -1”. This module overrides the current Rack resource name to provide a meaningful name.

Instance Method Summary collapse

Instance Method Details

#on_openObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/datadog/tracing/contrib/action_cable/instrumentation.rb', line 15

def on_open
  Tracing.trace(Ext::SPAN_ON_OPEN) do |span, trace|
    span.resource = "#{self.class}#on_open"
    span.type = Tracing::Metadata::Ext::AppTypes::TYPE_WEB

    span.set_tag(Ext::TAG_ACTION, 'on_open')
    span.set_tag(Ext::TAG_CONNECTION, self.class.to_s)

    span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
    span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_ON_OPEN)

    # Set the resource name of the trace
    trace.resource = span.resource

    super
  end
end