mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-16 09:52:54 +00:00
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.
28 lines
616 B
Rust
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)
|
|
}
|