Files
neon/libs/utils/src/sentry_init.rs
Kliment Serafimov 8f2b3cbded Sentry integration for storage. (#2926)
Added basic instrumentation to integrate sentry with the proxy, pageserver, and safekeeper processes.
Currently in sentry there are three projects, one for each process. Sentry url is sent to all three processes separately via cli args.
2022-12-06 18:57:54 +00:00

28 lines
616 B
Rust

use sentry::ClientInitGuard;
use std::borrow::Cow;
use std::env;
pub use sentry::release_name;
#[must_use]
pub fn init_sentry(
release_name: Option<Cow<'static, str>>,
extra_options: &[(&str, &str)],
) -> Option<ClientInitGuard> {
let dsn = env::var("SENTRY_DSN").ok()?;
let guard = sentry::init((
dsn,
sentry::ClientOptions {
release: release_name,
..Default::default()
},
));
sentry::configure_scope(|scope| {
for &(key, value) in extra_options {
scope.set_extra(key, value.into());
}
});
Some(guard)
}