Sha256: e189f004c6d897dab9ccf6fe942aaac94b7df57e57e3e67f686ed49f5a1ff954

Contents?: true

Size: 1.14 KB

Versions: 17

Compression:

Stored size: 1.14 KB

Contents

if defined?(ActiveJob)
  module Sentry
    parent_job =
      if defined?(::ApplicationJob) && ::ApplicationJob.ancestors.include?(::ActiveJob::Base)
        ::ApplicationJob
      else
        ::ActiveJob::Base
      end

    class SendEventJob < parent_job
      # the event argument is usually large and creates noise
      self.log_arguments = false if respond_to?(:log_arguments=)

      # this will prevent infinite loop when there's an issue deserializing SentryJob
      if respond_to?(:discard_on)
        discard_on ActiveJob::DeserializationError
      else
        # mimic what discard_on does for Rails 5.0
        rescue_from ActiveJob::DeserializationError do
          logger.error "Discarded #{self.class} due to a #{exception}. The original exception was #{error.cause.inspect}."
        end
      end

      def perform(event, hint = {})
        # users don't need the tracing result of this job
        if transaction = Sentry.get_current_scope.span
          transaction.instance_variable_set(:@sampled, false)
        end

        Sentry.send_event(event, hint)
      end
    end
  end
else
  module Sentry
    class SendEventJob; end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
sentry-rails-4.6.5 app/jobs/sentry/send_event_job.rb
sentry-rails-4.6.4 app/jobs/sentry/send_event_job.rb
sentry-rails-4.6.3 app/jobs/sentry/send_event_job.rb
sentry-rails-4.6.2 app/jobs/sentry/send_event_job.rb
sentry-rails-4.6.1 app/jobs/sentry/send_event_job.rb
sentry-rails-4.6.0 app/jobs/sentry/send_event_job.rb
sentry-rails-4.6.0.pre.beta.0 app/jobs/sentry/send_event_job.rb
sentry-rails-4.5.2 app/jobs/sentry/send_event_job.rb
sentry-rails-4.5.1 app/jobs/sentry/send_event_job.rb
sentry-rails-4.5.0 app/jobs/sentry/send_event_job.rb
sentry-rails-4.5.0.pre.beta.1 app/jobs/sentry/send_event_job.rb
sentry-rails-4.4.0 app/jobs/sentry/send_event_job.rb
sentry-rails-4.4.0.pre.beta.0 app/jobs/sentry/send_event_job.rb
sentry-rails-4.3.4 app/jobs/sentry/send_event_job.rb
sentry-rails-4.3.3 app/jobs/sentry/send_event_job.rb
sentry-rails-4.3.3.pre.beta.0 app/jobs/sentry/send_event_job.rb
sentry-rails-4.3.2 app/jobs/sentry/send_event_job.rb