sentry
ModuleErrors as Sentry issues.
Contents
use utopia_span::exporter::sentry::Request;Rust
pub struct RequestAn HTTP request to Sentry's envelope endpoint.
use utopia_span::Sentry;Rust
pub struct SentryReports spans at warning level or above that carry an error as Sentry issues.
Each event carries the error and its chain of causes (at most 10, root
cause first), the trace context, http.url, http.method and
http.query as the request, http.response.status_code as the response,
and every other attribute (except span.* and level) as a context, tag
or extra, as the classifier decides. A boolean span.handled attribute
sets whether the error was handled; otherwise fatal spans are unhandled.
Rust
use std::sync::{Arc, Mutex};
use utopia_span::exporter::Request;
use utopia_span::{Exporter, Failure, Level, Sentry, Span};
let sent = Arc::new(Mutex::new(Vec::<Request>::new()));
let log = sent.clone();
let sentry = Sentry::new("https://publickey@sentry.example.com:9000/123")?
.transport(move |request: Request| log.lock().unwrap().push(request));
let span = Span::new("test");
span.finish_with(Some(Level::Error), Some(Failure::new("RuntimeException", "Test error")));
assert!(sentry.sample(&span));
sentry.export(&span);
let request = &sent.lock().unwrap()[0];
assert_eq!(request.url, "https://sentry.example.com:9000/api/123/envelope/");
assert!(String::from_utf8_lossy(&request.body).contains(r#""value":"Test error""#));Also implements
Debug.use utopia_span::exporter::sentry::SentryField;Rust
pub enum SentryFieldWhere a span attribute goes in a Sentry event.
use utopia_span::exporter::sentry::SentryLevel;Rust
pub enum SentryLevelThe levels of Sentry's event API.
use utopia_span::exporter::sentry::Transport;Rust
pub trait Transport: Send + SyncSends envelopes to Sentry.
A transport reports its own failures: tracing never fails the application.
Implemented byF