1

Experimental sentry integration

This commit is contained in:
Evan Pratten 2023-07-20 14:42:51 -04:00
parent 85429ce59c
commit 81eaf22be0
2 changed files with 23 additions and 0 deletions

View File

@ -12,9 +12,19 @@ license = "GPL-3.0"
keywords = []
categories = []
[features]
default = ["sentry"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
protomask-tun = { path = "protomask-tun", version = "0.1.0" }
sentry = { version = "0.31.5", default-features = false, optional = true, features = [
"reqwest",
"rustls",
"backtrace",
"contexts",
"panic"
] }
tokio = { version = "1.29.1", features = [
"macros",
"rt-multi-thread",
@ -38,6 +48,7 @@ rtnetlink = "0.13.0"
futures = "0.3.28"
prometheus = "0.13.3"
lazy_static = "1.4.0"
cfg-if="1.0.0"
[[bin]]
name = "protomask"

View File

@ -1,5 +1,6 @@
//! This is the entrypoint for `protomask` from the command line.
use cfg_if::cfg_if;
use clap::Parser;
use config::Config;
use logging::enable_logger;
@ -26,6 +27,17 @@ pub async fn main() {
std::process::exit(1);
}
// Enable Sentry reporting
cfg_if! {
if #[cfg(feature = "sentry")] {
log::debug!("Enabling Sentry reporting");
let _guard = sentry::init(("https://376a29d0fd7c40d0a82f05a7e8c3600e@o4504175421947904.ingest.sentry.io/4505563054080000", sentry::ClientOptions {
release: sentry::release_name!(),
..Default::default()
}));
}
}
// Create the NAT64 instance
let mut nat64 = Nat64::new(
config.nat64_prefix,