diff --git a/docs/source/tracing/tracing.md b/docs/source/tracing/tracing.md index 2d54fb333c..ebbf4a64cc 100644 --- a/docs/source/tracing/tracing.md +++ b/docs/source/tracing/tracing.md @@ -17,7 +17,8 @@ Queries that support tracing: * [`Session::prepare()`](prepare.md) After obtaining the tracing id you can use `Session::get_tracing_info()` to query tracing information.\ -`TracingInfo` contains values that are the same in Scylla and Cassandra®, skipping any database-specific ones.\ +`Session::get_tracing_info()` returns a `TracingInfo` which only contains values that are the same +in both Scylla and Cassandra®, skipping any database-specific ones.\ If `TracingInfo` does not contain some needed value it's possible to query it manually from the tables `system_traces.sessions` and `system_traces.events` diff --git a/scylla/src/tracing.rs b/scylla/src/tracing.rs index 3d40e36431..a1d8a3c3c0 100644 --- a/scylla/src/tracing.rs +++ b/scylla/src/tracing.rs @@ -18,6 +18,12 @@ pub struct TracingInfo { pub request: Option, /// started_at is a timestamp - time since unix epoch pub started_at: Option, + /// only present in Scylla + pub request_size: Option, + /// only present in Scylla + pub response_size: Option, + /// only present in Scylla + pub username: Option, pub events: Vec, } @@ -30,6 +36,10 @@ pub struct TracingEvent { pub source: Option, pub source_elapsed: Option, pub thread: Option, + /// only present in Scylla + pub scylla_parent_id: Option, + /// only present in Scylla + pub scylla_span_id: Option, } impl TracingInfo { @@ -75,6 +85,9 @@ impl FromRow for TracingInfo { parameters, request, started_at, + request_size: None, + response_size: None, + username: None, events: Vec::new(), }) } @@ -97,6 +110,8 @@ impl FromRow for TracingEvent { source, source_elapsed, thread, + scylla_parent_id: None, + scylla_span_id: None, }) } } diff --git a/scylla/src/transport/session.rs b/scylla/src/transport/session.rs index 35ff25475f..39eb064238 100644 --- a/scylla/src/transport/session.rs +++ b/scylla/src/transport/session.rs @@ -1360,6 +1360,11 @@ impl Session { /// /// See [the book](https://rust-driver.docs.scylladb.com/stable/tracing/tracing.html) /// for more information about query tracing + /// + /// Does not query for the fields that are only present in the Scylla schema ( + /// [request_size](TracingInfo::request_size), [response_size](TracingInfo::response_size), + /// [username](TracingInfo::username), [scylla_parent_id](TracingEvent::scylla_parent_id), + /// and [scylla_span_id](TracingEvent::scylla_span_id)). pub async fn get_tracing_info(&self, tracing_id: &Uuid) -> Result { // tracing_info_fetch_attempts is NonZeroU32 so at least one attempt will be made for _ in 0..self.tracing_info_fetch_attempts.get() { @@ -1396,9 +1401,15 @@ impl Session { self.keyspace_name.load_full() } - // Tries getting the tracing info - // If the queries return 0 rows then returns None - the information didn't reach this node yet - // If there is some other error returns this error + // Tries getting the tracing info from `system_traces`. + // + // If the queries return 0 rows then returns `Ok(None)` - the information didn't reach this + // node yet. + // + // If there is some other error returns `Err(that_error)`. + // + // Does not query for the fields that are only present in the Scylla schema (request_size, + // response_size, username, scylla_parent_id, and scylla_span_id). async fn try_getting_tracing_info( &self, tracing_id: &Uuid,