Skip to content

Commit f61312f

Browse files
Fix rust automatic-instrumentation.mdx (#8285)
* Update automatic-instrumentation.mdx The tower rust docs state that the `Hub` layer should always come before the `Http` layer. https://docs.rs/sentry-tower/latest/sentry_tower/#usage-with-tower-http The sentry docs should reflect this. * Update src/platforms/rust/common/performance/instrumentation/automatic-instrumentation.mdx Co-authored-by: Shana Matthews <shana.l.matthews@gmail.com> --------- Co-authored-by: Shana Matthews <shana.l.matthews@gmail.com>
1 parent 93d999e commit f61312f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/platforms/rust/common/performance/instrumentation/automatic-instrumentation.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ fn main_span2() {
5050

5151
The Sentry SDK offers an integration for the `tower` ecosystem which can automatically continue a trace from an incoming HTTP request.
5252

53+
When combining both layers, order matters. For example, with tower::ServiceBuilder, you must define the Hub layer before the Http one, like so:
54+
5355
```rust
5456
use sentry_tower::{NewSentryLayer, SentryHttpLayer};
5557
use tower::ServiceBuilder;
5658

5759
let layer = ServiceBuilder::new()
58-
// continue trace from incoming request
59-
.layer(SentryHttpLayer::with_transaction())
60-
// bind a new hub for each request
61-
.layer(NewSentryLayer::new_from_top());
60+
.layer(NewSentryLayer::new_from_top())
61+
.layer(SentryHttpLayer::with_transaction());
6262
```

0 commit comments

Comments
 (0)