Skip to content

Commit ab9268f

Browse files
committed
feat(rust): add getting started docs for tracing
1 parent c11aa8c commit ab9268f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

docs/platforms/rust/guides/tracing/index.mdx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ fn main() {
5959
.with(sentry_layer)
6060
.init();
6161

62-
// Futures need to be bound to a Hub
62+
// Futures should to be bound to a Hub
6363
// Learn more at https://docs.rs/sentry-core/latest/sentry_core/#parallelism-concurrency-and-async
6464
fail().bind_hub(sentry::Hub::current()).await;
6565
}
@@ -68,18 +68,21 @@ fn main() {
6868
#[tracing::instrument] // Captures a root span (transaction) around this function execution
6969
# ___PRODUCT_OPTION_END___ performance
7070
async fn fail() {
71+
tracing::debug!("Doing work"); // Adds a breadrcumb
7172
# ___PRODUCT_OPTION_START___ performance
7273
let _span = tracing::info_span("Child span").entered(); // Captures a child span
7374
# ___PRODUCT_OPTION_END___ performance
7475
tracing::error!("Everything is on fire!");
7576
}
7677
```
7778

79+
By default, error level events are captured as Sentry events, while anything at or above info is added as a breadcrumb.
80+
7881
{/* ___PRODUCT_OPTION_START___ logs */}
7982

80-
To capture logs for `tracing` events, you need to set up a custom event filter, like so:
83+
To capture structured logs for `tracing` events instead, you need to set up the Sentry layer with a custom event filter that maps to logs, like so:
8184

82-
```rs
85+
```rust
8386
use sentry::integrations::tracing::EventFilter;
8487

8588
sentry::integrations::tracing::layer().event_filter(|md| match *md.level() {

0 commit comments

Comments
 (0)