You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/platforms/rust/guides/tracing/index.mdx
+17-5Lines changed: 17 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,12 +27,19 @@ sentry = { version = "{{@inject packages.version('sentry.rust') }}", features =
27
27
"logs",
28
28
# ___PRODUCT_OPTION_END___ logs
29
29
] }
30
+
tokio = { version = "1.45.0", features = ["full"] }
30
31
```
31
32
32
33
## Configure
33
34
34
35
Initialize the Sentry SDK and register the Sentry layer to start sending `tracing` events and spans to Sentry:
35
36
37
+
<Alertlevel="warning">
38
+
39
+
Macros like `#[tokio::main]` and `#[actix_web::main]` are not supported. The Sentry client must be initialized before the async runtime is started, as shown below.
40
+
41
+
</Alert>
42
+
36
43
```rust
37
44
usetracing_subscriber::prelude::*;
38
45
@@ -56,12 +63,17 @@ fn main() {
56
63
// Register the Sentry tracing layer
57
64
tracing_subscriber::registry()
58
65
.with(tracing_subscriber::fmt::layer())
59
-
.with(sentry_layer)
66
+
.with(sentry::integrations::tracing::layer())
60
67
.init();
61
-
62
-
// Futures should to be bound to a Hub
63
-
// Learn more at https://docs.rs/sentry-core/latest/sentry_core/#parallelism-concurrency-and-async
64
-
fail().bind_hub(sentry::Hub::current()).await;
68
+
69
+
tokio::runtime::Builder::new_multi_thread()
70
+
.enable_all()
71
+
.build()?
72
+
.block_on(async {
73
+
// Futures should to be bound to a Hub
74
+
// Learn more at https://docs.rs/sentry-core/latest/sentry_core/#parallelism-concurrency-and-async
0 commit comments