Module: Rails::Instrumentation::ActionCableSubscriber

Includes:
Subscriber
Defined in:
lib/rails/instrumentation/subscribers/action_cable_subscriber.rb

Constant Summary collapse

EVENT_NAMESPACE =
'action_cable'.freeze
EVENTS =
%w[
  perform_action
  transmit
  transmit_subscription_confirmation
  transmit_subscription_rejection
  broadcast
].freeze
BASE_TAGS =

rubocop:disable Style/MutableConstant

{ 'component' => 'ActionCable' }

Class Method Summary collapse

Methods included from Subscriber

included

Class Method Details

.broadcast(event) ⇒ Object



57
58
59
60
61
62
63
64
65
# File 'lib/rails/instrumentation/subscribers/action_cable_subscriber.rb', line 57

def broadcast(event)
  tags = span_tags(
    'broadcasting' => event.payload[:broadcasting],
    'message' => event.payload[:message],
    'coder' => event.payload[:coder]
  )

  Utils.trace_notification(event: event, tags: tags)
end

.perform_action(event) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/rails/instrumentation/subscribers/action_cable_subscriber.rb', line 21

def perform_action(event)
  tags = span_tags(
    'channel_class' => event.payload[:channel_class],
    'action' => event.payload[:action],
    'data' => event.payload[:data]
  )

  Utils.trace_notification(event: event, tags: tags)
end

.transmit(event) ⇒ Object



31
32
33
34
35
36
37
38
39
# File 'lib/rails/instrumentation/subscribers/action_cable_subscriber.rb', line 31

def transmit(event)
  tags = span_tags(
    'channel_class' => event.payload[:channel_class],
    'data' => event.payload[:data],
    'via' => event.payload[:via]
  )

  Utils.trace_notification(event: event, tags: tags)
end

.transmit_subscription_confirmation(event) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/rails/instrumentation/subscribers/action_cable_subscriber.rb', line 41

def transmit_subscription_confirmation(event)
  tags = span_tags(
    'channel_class' => event.payload[:channel_class]
  )

  Utils.trace_notification(event: event, tags: tags)
end

.transmit_subscription_rejection(event) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/rails/instrumentation/subscribers/action_cable_subscriber.rb', line 49

def transmit_subscription_rejection(event)
  tags = span_tags(
    'channel_class' => event.payload[:channel_class]
  )

  Utils.trace_notification(event: event, tags: tags)
end