diff options
author | Matthew Wear <mwear@newrelic.com> | 2016-05-11 16:55:17 -0700 |
---|---|---|
committer | Matthew Wear <mwear@newrelic.com> | 2016-05-12 10:56:35 -0700 |
commit | f3ba0c1dd32821ad700b2784d160d1c161fb3125 (patch) | |
tree | f89c7555ed6f43a24bbb8d228a4a894dd624e007 /actioncable/lib/action_cable/server | |
parent | 537a342a8307ebe1d5e69a7e81495f137ae571a4 (diff) | |
download | rails-f3ba0c1dd32821ad700b2784d160d1c161fb3125.tar.gz rails-f3ba0c1dd32821ad700b2784d160d1c161fb3125.tar.bz2 rails-f3ba0c1dd32821ad700b2784d160d1c161fb3125.zip |
Add ActiveSupport::Notifications hook to Broadcaster#broadcast
This addition of this notification hook will give users better visibility
into the messages being sent over the PubSub adapter.
Diffstat (limited to 'actioncable/lib/action_cable/server')
-rw-r--r-- | actioncable/lib/action_cable/server/broadcasting.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/actioncable/lib/action_cable/server/broadcasting.rb b/actioncable/lib/action_cable/server/broadcasting.rb index 8f93564113..1fc58baa3e 100644 --- a/actioncable/lib/action_cable/server/broadcasting.rb +++ b/actioncable/lib/action_cable/server/broadcasting.rb @@ -39,8 +39,12 @@ module ActionCable def broadcast(message) server.logger.info "[ActionCable] Broadcasting to #{broadcasting}: #{message.inspect}" - encoded = coder ? coder.encode(message) : message - server.pubsub.broadcast broadcasting, encoded + + payload = { broadcasting: broadcasting, message: message, coder: coder } + ActiveSupport::Notifications.instrument("broadcast.action_cable", payload) do + encoded = coder ? coder.encode(message) : message + server.pubsub.broadcast broadcasting, encoded + end end end end |