-
-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support non-exception error values from Oban jobs #807
Changes from 1 commit
6a47cc7
fa1697b
a407100
d81b8da
025dae6
078a802
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,18 +33,22 @@ defmodule Sentry.Integrations.Oban.ErrorReporter do | |
end | ||
|
||
_ = | ||
Sentry.capture_exception(exception, | ||
stacktrace: stacktrace, | ||
tags: %{oban_worker: job.worker, oban_queue: job.queue, oban_state: job.state}, | ||
fingerprint: [ | ||
inspect(exception.__struct__), | ||
inspect(job.worker), | ||
Exception.message(exception) | ||
], | ||
extra: | ||
Map.take(job, [:args, :attempt, :id, :max_attempts, :meta, :queue, :tags, :worker]), | ||
integration_meta: %{oban: %{job: job}} | ||
) | ||
if is_struct(exception) do | ||
Sentry.capture_exception(exception, | ||
stacktrace: stacktrace, | ||
tags: %{oban_worker: job.worker, oban_queue: job.queue, oban_state: job.state}, | ||
fingerprint: [ | ||
inspect(exception.__struct__), | ||
inspect(job.worker), | ||
Exception.message(exception) | ||
], | ||
extra: | ||
Map.take(job, [:args, :attempt, :id, :max_attempts, :meta, :queue, :tags, :worker]), | ||
integration_meta: %{oban: %{job: job}} | ||
) | ||
else | ||
Sentry.capture_message("Error with %s", interpolation_parameters: [exception]) | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be more clear to have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True! Updated, thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a wildly generic error message we got going on here 😄 I think it'd be really hard to debug as it's just a generic message plus there are no metadata about the job (which you have available). This needs to be completely restructured to basically build shared options, and then use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also let's have the message be something like "Oban job #{job.worker} errored out: %s" Btw the fingerprint option needs to be customized, if it's just reason use |
||
|
||
:ok | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want more specifically
is_exception
here, rather than justis_struct
, because I thinkException.message/1
below won't work on just any general struct.This may not really matter in practice, though, because I think the errors will probably never end up being a struct other than an Exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not but good to use the right tool for the job. Thanks and updated!