class NewRelic::Agent::Instrumentation::ActionCableSubscriber

Constants

DOT_ACTION_CABLE
PERFORM_ACTION

Public Instance Methods

start_segment(name, id, payload) click to toggle source
# File lib/new_relic/agent/instrumentation/action_cable_subscriber.rb, line 13
def start_segment(name, id, payload) # THREAD_LOCAL_ACCESS
  finishable = if name == PERFORM_ACTION
    Tracer.start_transaction_or_segment(
      name: transaction_name_from_payload(payload),
      category: :action_cable
    )
  else
    Tracer.start_segment(name: metric_name_from_payload(name, payload))
  end
  push_segment(id, finishable)
end

Private Instance Methods

action_name(name) click to toggle source
# File lib/new_relic/agent/instrumentation/action_cable_subscriber.rb, line 41
def action_name(name)
  name.gsub(DOT_ACTION_CABLE, NewRelic::EMPTY_STR)
end
metric_name(payload) click to toggle source
# File lib/new_relic/agent/instrumentation/action_cable_subscriber.rb, line 35
def metric_name(payload)
  payload[:broadcasting] || payload[:channel_class]
end
metric_name_from_payload(name, payload) click to toggle source
# File lib/new_relic/agent/instrumentation/action_cable_subscriber.rb, line 31
def metric_name_from_payload(name, payload)
  "Ruby/ActionCable/#{metric_name(payload)}/#{action_name(name)}"
end
transaction_name_from_payload(payload) click to toggle source
# File lib/new_relic/agent/instrumentation/action_cable_subscriber.rb, line 27
def transaction_name_from_payload(payload)
  "Controller/ActionCable/#{payload[:channel_class]}/#{payload[:action]}"
end