feat(rust/gui-client): add sentry.io error reporting#6782
feat(rust/gui-client): add sentry.io error reporting#6782ReactorScram merged 51 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Also add `firezone-logging` which slipped through This is factored out from #6782
thomaseizinger
left a comment
There was a problem hiding this comment.
LGTM
Just one ask around instrumenting caught panics in Session.
| telemetry::add_breadcrumb(telemetry::Breadcrumb { | ||
| ty: "fail_on_purpose".into(), | ||
| message: Some("Will crash / error / panic on purpose to test error handling.".into()), | ||
| ..Default::default() | ||
| }); |
There was a problem hiding this comment.
I guess we are not leaving this in?
There was a problem hiding this comment.
I'd like to, it's handy for testing error handling. The flags for it were already present since they were left in after testing the existing crash handling and logging.
| .make_tun() | ||
| .map_err(|e| Error::TunnelDevice(e.to_string()))?; | ||
| connlib.set_tun(Box::new(tun)); | ||
| tun_span.finish(); |
There was a problem hiding this comment.
I think this might also be somewhat misleading because all we do as part of set_tun is writing it to a channel.
There was a problem hiding this comment.
Doesn't make_tun run some of the platform-specific code like parts of WinTun?
There was a problem hiding this comment.
Ah yeah, I didn't see that it is covering the make_tun part too. It would be nice if we could just get this data from tracing without having to depend on our telemetry module everywhere.
Extracted from #6782 This moves more of `main` inside the async block, which makes it easier to set up telemetry in the future. We also log errors for the DNS notifier, which was overlooked before.
This makes it easy to add more fields to `Controller` without making them all public. This is factored out from #6782 --------- Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| tool: dump_syms,minidump-stackwalk |
There was a problem hiding this comment.
Don't need this since Sentry reads crash dumps for us
There was a problem hiding this comment.
Something in here was causing a bug in sentry, so I deleted the file and let Cargo recreate it.
| firezone-logging = { workspace = true } | ||
| futures = { version = "0.3", default-features = false } | ||
| hex = "0.4.3" | ||
| minidumper = "0.8.3" |
There was a problem hiding this comment.
Don't need any of our old crash handling stuff
| tokio = { workspace = true, features = ["signal", "time", "macros", "rt", "rt-multi-thread"] } | ||
| tokio-util = { version = "0.7.11", features = ["codec"] } | ||
| tracing = { workspace = true } | ||
| tracing-panic = "0.1.2" |
There was a problem hiding this comment.
Can't use this since there can only be one panic hook. (I guess we could wrap both of them but I didn't try that)
| sentry::add_breadcrumb(Breadcrumb { | ||
| ty: "logging_start".into(), | ||
| category: None, | ||
| data: { | ||
| let mut map = BTreeMap::default(); | ||
| map.insert("directives".into(), directives.into()); | ||
| map.insert("git_version".into(), git_version.into()); | ||
| map.insert("system_uptime_seconds".into(), system_uptime_seconds.into()); | ||
| map | ||
| }, | ||
| ..Default::default() | ||
| }); |
There was a problem hiding this comment.
This breadcrumb shows up in Sentry's web UI and I like the idea of breadcrumbs a lot
| callbacks, | ||
| }; | ||
| let _guard = rt.enter(); // Constructing `PhoenixChannel` requires a runtime context. | ||
| rt.block_on(async { |
There was a problem hiding this comment.
Made firezone-telemetry its own crate even though the code is small, because Gateways and Relays may want it in the future.
| telemetry::add_breadcrumb(telemetry::Breadcrumb { | ||
| ty: "fail_on_purpose".into(), | ||
| message: Some("Will crash / error / panic on purpose to test error handling.".into()), | ||
| ..Default::default() | ||
| }); |
There was a problem hiding this comment.
I'd like to, it's handy for testing error handling. The flags for it were already present since they were left in after testing the existing crash handling and logging.
| .make_tun() | ||
| .map_err(|e| Error::TunnelDevice(e.to_string()))?; | ||
| connlib.set_tun(Box::new(tun)); | ||
| tun_span.finish(); |
There was a problem hiding this comment.
Doesn't make_tun run some of the platform-specific code like parts of WinTun?
Refs #6138
Sentry is always enabled for now. In the near future we'll make it opt-out per device and opt-in per org (see #6138 for details)
crash_handlingmodulewss://api.firezone.devExample screenshot of sentry.io with a caught panic: