module Datadog::Contrib::ActionCable::Events::Transmit

Defines instrumentation for 'transmit.action_cable' event.

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

Constants

EVENT_NAME

Public Instance Methods

event_name() click to toggle source
# File lib/ddtrace/contrib/action_cable/events/transmit.rb, line 19
def event_name
  self::EVENT_NAME
end
process(span, _event, _id, payload) click to toggle source
# File lib/ddtrace/contrib/action_cable/events/transmit.rb, line 32
def process(span, _event, _id, payload)
  channel_class = payload[:channel_class]

  span.service = 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])
end
span_name() click to toggle source
# File lib/ddtrace/contrib/action_cable/events/transmit.rb, line 23
def span_name
  Ext::SPAN_TRANSMIT
end
span_type() click to toggle source
# File lib/ddtrace/contrib/action_cable/events/transmit.rb, line 27
def span_type
  # ActionCable transmits data over WebSockets
  Datadog::Ext::AppTypes::WEB
end