# frozen_string_literal: true module Bugscriber module Subscribers extend ActiveSupport::Concern AVAILABLE_SUBSCRIPTIONS = %w[ action_controller action_dispatch action_view active_record action_mailer active_support active_job action_cable active_storage railties rails ].freeze included do AVAILABLE_SUBSCRIPTIONS.each do |subscription_method| ActiveSupport::Notifications.subscribe(/#{subscription_method}/) do |name, started, finished, unique_id, data| Bugscriber::Helpers.create_track(type: subscription_method, method: name, started_at: started, finished_at: finished, external_process_id: unique_id, payload: data) end end end end end