-
Notifications
You must be signed in to change notification settings - Fork 212
Resolves #1151 - send errors, error-logs and panics to sentry #1486
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
Conversation
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.
This is really cool :) do you know how I can test it?
sentry_dsn, | ||
sentry::ClientOptions { | ||
release: Some(docs_rs::BUILD_VERSION.into()), | ||
attach_stacktrace: true, |
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.
Hmm, why set this? The docs say:
When enabled, stack traces are automatically attached to all messages logged. Stack traces are always attached to exceptions; however, when this option is set, stack traces are also sent with messages. This option, for instance, means that stack traces appear next to all log messages.
and I don't think it's super useful to show a backtrace for the top-level error! macro, since it will always be the same.
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.
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.
I might be wrong, but in testing the stacktrace looked correct, from the place where the log::error call was made:
Right - but my point is that usually we want the stacktrace of the error itself, not the error! call.
I guess that's an argument for getting rid of error! altogether and changing all those to capture_anyhow
; I would be ok leaving this in until we do that.
@jyn514 short answer to this question: |
@jyn514 IMHO you can have another look :) I replaced Right now I'm not sure
Also, from a rust perspective, if there is a better way than the
|
Fixing them as they occur seems fine - I'd rather have too many alerts than too few.
Another macro seems fine. I don't know how to do it through traits without messing with it on desktop, and I don't think it needs to block the PR. |
@jyn514 this is probably ready for another review :) |
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.
LGTM :) @Nemo157 feel free to review too if you like, I won't merge this until the next time I do a deploy (so probably no sooner than Saturday).
This PR starts sending errors to sentry.
What is sent to sentry now (including backtraces):
log::error!
anyhow::Error
, when ending up in themain
handlerpanic!
everywhereI'm not 100% sure if there need to be more places changed?
open topics / question
error!
calls in the codebase stay errors being sent to sentry? I could imagine some of them should be changed to warnings? Or should we exclude error-logs from sentry?I would love to switch the handling code in the(done, thanks to @jyn514)ctry!
to usecapture_anyhow
when it gets a fitting error type, but I wasn't sure about the best approach.