Last active
June 8, 2018 07:46
-
-
Save coorasse/395433b21f787751e3f0861b5bb14409 to your computer and use it in GitHub Desktop.
Sending Sentry Raven events asynchronously with ActiveJob
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Raven.configure(true) do |config| | |
config.async = ->(event) { SentryJob.perform_later(event) } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SentryJob < ActiveJob::Base | |
queue_as :default | |
before_enqueue do |job| | |
job.arguments[0] = job.arguments[0].to_hash if job.arguments[0] | |
end | |
def perform(event) | |
Raven.send_event(event) if defined?(Raven) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment