-
-
Notifications
You must be signed in to change notification settings - Fork 164
eyre and color-eyre integration #270
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
Comments
Maintainer of eyre/color-eyre here. At work we're in the process of integrating sentry with our application. I got some basic integration setup but the Once we've got it figured out though I'll be happy to upstream any integration we end up writing. Here's what a color-eyre report looks like in the sentry UI: Using this minimal setup code (ty again for the API @kellpossible ^_^): let builder = color_eyre::config::HookBuilder::default()
.theme(theme)
.issue_url(concat!(env!("CARGO_PKG_REPOSITORY"), "/issues/new"))
.add_issue_metadata("version", env!("CARGO_PKG_VERSION"))
.add_issue_metadata("git commit", Self::git_commit())
.issue_filter(|kind| match kind {
color_eyre::ErrorKind::NonRecoverable(_) => true,
color_eyre::ErrorKind::Recoverable(error) => {
!error.is::<tower::timeout::error::Elapsed>()
}
});
let (panic_hook, eyre_hook) = builder.into_hooks();
eyre_hook.install().unwrap();
// The Sentry default config pulls in the DSN from the `SENTRY_DSN`
// environment variable.
let guard = sentry::init(
sentry::ClientOptions {
debug: true,
..Default::default()
}
.add_integration(sentry_tracing::TracingIntegration::default()),
);
std::panic::set_hook(Box::new(move |panic_info| {
let panic_report = panic_hook.panic_report(panic_info).to_string();
let event = sentry::protocol::Event {
exception: vec![sentry::protocol::Exception {
ty: "panic".into(),
mechanism: Some(sentry::protocol::Mechanism {
ty: "panic".into(),
handled: Some(false),
..Default::default()
}),
value: Some(panic_report),
stacktrace: sentry::integrations::backtrace::current_stacktrace(),
..Default::default()
}]
.into(),
level: sentry::Level::Fatal,
..Default::default()
};
sentry::capture_event(event);
// required because we use `panic = abort`
if !guard.close(None) {
warn!("unable to flush sentry events during panic");
}
}));
panic!("fancy foo"); |
Is there an eyre counterpart for |
Sorry for the long delay. No, there isn't, at least not within Sentry. |
Hi all, we have decided to close this issue for now. While this is a legitimate feature request, our team likely will not have the capacity to implement and support this new feature anytime in the near future. We would gladly be willing to accept PRs for this feature, but since we are not planning to implement this feature ourselves, I am closing the issue for now. |
It would be good to have support for eyre/color-eyre too along with #180
The text was updated successfully, but these errors were encountered: