Sha256: fc06daf53920a89373d1e30e020a465178d12c2b741e4cb48831173977185dff

Contents?: true

Size: 685 Bytes

Versions: 3

Compression:

Stored size: 685 Bytes

Contents

# frozen_string_literal: true

module Lograge
  module ActionCable
    module ChannelInstrumentation
      def subscribe_to_channel
        ActiveSupport::Notifications.instrument('subscribe.action_cable', notification_payload('subscribe')) { super }
      end

      def unsubscribe_from_channel
        ActiveSupport::Notifications.instrument('unsubscribe.action_cable', notification_payload('unsubscribe')) do
          super
        end
      end

      private

      def notification_payload(method_name)
        { channel_class: self.class.name, action: method_name }
      end
    end
  end
end

ActionCable::Channel::Base.prepend(Lograge::ActionCable::ChannelInstrumentation)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lograge-0.14.0 lib/lograge/rails_ext/action_cable/channel/base.rb
lograge-0.13.0 lib/lograge/rails_ext/action_cable/channel/base.rb
lograge-0.12.0 lib/lograge/rails_ext/action_cable/channel/base.rb