Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: API for manual performance monitoring (NATIVE-309) #395

Merged
merged 14 commits into from
Jan 10, 2022
Prev Previous commit
Next Next commit
link trace context to events
  • Loading branch information
Swatinem committed Jan 3, 2022
commit 44ff68a87376f6aae58b493eb026830fa8b851d2
4 changes: 2 additions & 2 deletions sentry-core/src/performance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ struct TransactionInner {

type TransactionArc = Arc<Mutex<TransactionInner>>;

#[derive(Debug)]
#[derive(Clone, Debug)]
pub struct Transaction {
inner: TransactionArc,
}
Expand Down Expand Up @@ -174,7 +174,7 @@ impl Transaction {
}
}

#[derive(Debug)]
#[derive(Clone, Debug)]
pub struct Span {
transaction: TransactionArc,
span: protocol::Span,
Expand Down
4 changes: 2 additions & 2 deletions sentry-core/src/scope/real.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ impl Scope {
Some(event)
}

pub fn set_span(&mut self) {
// self.
pub fn set_span(&mut self, span: Option<TransactionOrSpan>) {
self.span = Arc::new(span);
}

pub(crate) fn update_session_from_event(&self, event: &Event<'static>) {
Expand Down
7 changes: 7 additions & 0 deletions sentry/examples/performance-demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ fn main() {
thread::sleep(Duration::from_millis(100));

let span2 = span1.start_child("span2");
sentry::configure_scope(|scope| {
scope.set_span(Some(sentry::TransactionOrSpan::Span(span2.clone())))
});
sentry::capture_message(
"A message that should have a trace context",
sentry::Level::Info,
);
thread::sleep(Duration::from_millis(200));
span2.finish();

Expand Down