Skip to content

Commit 871f727

Browse files
authored
docs: Advise users to override automatic transaction name (#436)
1 parent 2f67b12 commit 871f727

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

sentry-tower/src/http.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ use tower_service::Service;
1212
/// The Service created by this Layer can also optionally start a new
1313
/// performance monitoring transaction for each incoming request,
1414
/// continuing the trace based on incoming distributed tracing headers.
15+
///
16+
/// The created transaction will automatically use the request URI as its name.
17+
/// This is sometimes not desirable in case the request URI contains unique IDs
18+
/// or similar. In this case, users should manually override the transaction name
19+
/// in the request handler using the [`Scope::set_transaction`](sentry_core::Scope::set_transaction)
20+
/// method.
1521
#[derive(Clone, Default)]
1622
pub struct SentryHttpLayer {
1723
start_transaction: bool,

sentry-tower/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@
104104
//! onto captured events, and optionally start a new performance monitoring
105105
//! transaction based on the incoming HTTP headers.
106106
//!
107+
//! The created transaction will automatically use the request URI as its name.
108+
//! This is sometimes not desirable in case the request URI contains unique IDs
109+
//! or similar. In this case, users should manually override the transaction name
110+
//! in the request handler using the [`Scope::set_transaction`](sentry_core::Scope::set_transaction)
111+
//! method.
112+
//!
107113
//! When combining both layers, take care of the ordering of both. For example
108114
//! with [`tower::ServiceBuilder`], always define the `Hub` layer before the `Http`
109115
//! one, like so:

0 commit comments

Comments
 (0)