class Datadog::Tracing::Contrib::ActionCable::Instrumentation::ActionCableChannel::Tracer

Instrumentation for Channel hooks.

def self.trace(channel, hook)

def self.trace(channel, hook)
  configuration = Datadog.configuration.tracing[:action_cable]
  Tracing.trace("action_cable.#{hook}") do |span|
    span.service = configuration[:service_name] if configuration[:service_name]
    span.resource = "#{channel.class}##{hook}"
    span.span_type = Tracing::Metadata::Ext::AppTypes::TYPE_WEB
    # Set analytics sample rate
    if Contrib::Analytics.enabled?(configuration[:analytics_enabled])
      Contrib::Analytics.set_sample_rate(span, configuration[:analytics_sample_rate])
    end
    # Measure service stats
    Contrib::Analytics.set_measured(span)
    span.set_tag(Ext::TAG_CHANNEL_CLASS, channel.class.to_s)
    span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
    span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, hook)
    yield
  end
end