Module: Datadog::Tracing::Contrib::ActionCable::Events::Transmit

Includes:
Datadog::Tracing::Contrib::ActionCable::Event
Defined in:
lib/datadog/tracing/contrib/action_cable/events/transmit.rb

Overview

Defines instrumentation for ‘transmit.action_cable’ event.

A ‘transmit’ event sends a message to a single client subscribed to a channel.

Constant Summary collapse

EVENT_NAME =
'transmit.action_cable'.freeze

Class Method Summary collapse

Methods included from Datadog::Tracing::Contrib::ActionCable::Event

included

Class Method Details

.event_nameObject



21
22
23
# File 'lib/datadog/tracing/contrib/action_cable/events/transmit.rb', line 21

def event_name
  self::EVENT_NAME
end

.process(span, _event, _id, payload) ⇒ Object



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

def process(span, _event, _id, payload)
  channel_class = payload[:channel_class]

  span.service = configuration[:service_name] if configuration[:service_name]
  span.resource = channel_class
  span.span_type = span_type

  # Set analytics sample rate
  if Contrib::Analytics.enabled?(configuration[:analytics_enabled])
    Contrib::Analytics.set_sample_rate(span, configuration[:analytics_sample_rate])
  end

  span.set_tag(Ext::TAG_CHANNEL_CLASS, channel_class)
  span.set_tag(Ext::TAG_TRANSMIT_VIA, payload[:via])

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

.span_nameObject



25
26
27
# File 'lib/datadog/tracing/contrib/action_cable/events/transmit.rb', line 25

def span_name
  Ext::SPAN_TRANSMIT
end

.span_typeObject



29
30
31
32
# File 'lib/datadog/tracing/contrib/action_cable/events/transmit.rb', line 29

def span_type
  # ActionCable transmits data over WebSockets
  Tracing::Metadata::Ext::AppTypes::TYPE_WEB
end