pub struct Sentry;Expand description
Sends reports to Sentry or a Sentry-compatible service, as envelopes (the Sentry ingestion protocol).
Reads the DSN from the SENTRY_DSN secret (ocre secrets push SENTRY_DSN --file .prod.vars); without it, sends nothing. The optional
SENTRY_RELEASE variable sets the release. Each report becomes one
event: the error as the exception (type Report::class, value
Report::message, mechanism Report::source and handled), the
severity as level, the environment, request_id as a tag and the
context (filtered like logs) as extra data. One subrequest per report.
§Examples
use ocre::errors::{Options, Reporter, Sentry, Subscriber};
let reporter = Reporter::default();
reporter.report(&"boom", Options::new());
let report = &reporter.take()[0];
let dsn = |name: &str| (name == "SENTRY_DSN").then(|| "https://abc@o1.ingest.sentry.io/42".to_owned());
let delivery = Sentry.deliver(report, &dsn).unwrap();
assert_eq!(delivery.url, "https://o1.ingest.sentry.io/api/42/envelope/");
assert!(Sentry.deliver(report, &|_| None).is_none());Trait Implementations§
Auto Trait Implementations§
impl Freeze for Sentry
impl RefUnwindSafe for Sentry
impl Send for Sentry
impl Sync for Sentry
impl Unpin for Sentry
impl UnsafeUnpin for Sentry
impl UnwindSafe for Sentry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more