module Sentry::Rails::Tracing

def self.patch_active_support_notifications

so we need to retrieve the correct time this way
this is necessary because instrumentation events don't record absolute start/finish time
def self.patch_active_support_notifications
  unless ::ActiveSupport::Notifications::Instrumenter.ancestors.include?(SentryNotificationExtension)
    ::ActiveSupport::Notifications::Instrumenter.send(:prepend, SentryNotificationExtension)
  end
  SentryNotificationExtension.module_eval do
    def instrument(name, payload = {}, &block)
      # only inject timestamp to the events the SDK subscribes to
      if Tracing.subscribed_tracing_events.include?(name)
        payload[START_TIMESTAMP_NAME] = Time.now.utc.to_f if name[0] != "!" && payload.is_a?(Hash)
      end
      super(name, payload, &block)
    end
  end
end