Sha256: 860f95f0052b4b1caa5eb3cd9c277e0e263f0fdb9735da64c63e90a4e6676bca
Contents?: true
Size: 1.06 KB
Versions: 12
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true module PlainApm module Hooks class ActiveSupportSubscriber def install begin require "active_support/notifications" rescue LoadError return end asn = ActiveSupport::Notifications # Rails >= 6.1 if asn.respond_to?(:monotonic_subscribe) asn.monotonic_subscribe(notification_pattern, method(:collect)) else asn.subscribe(notification_pattern, method(:collect)) end end def collect(event) # id / transaction_id is by instrumenter and thread payload = payload(event) return if payload.nil? Agent.instance.collect(payload) end private def pattern raise "Not implemented" end def payload(event) raise "Not implemented" end def filtered_backtrace if defined?(Rails) && defined?(Rails::BacktraceCleaner) @cleaner ||= Rails::BacktraceCleaner.new @cleaner.clean(caller) end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems