@@ -18,6 +18,7 @@ use async_trait::async_trait;
1818use futures:: future:: join_all;
1919use futures:: future:: try_join_all;
2020use itertools:: { Either , Itertools } ;
21+ use scylla_cql:: frame:: response:: result:: RawMetadataAndRawRows ;
2122use scylla_cql:: frame:: response:: result:: { deser_cql_value, ColumnSpec } ;
2223use scylla_cql:: frame:: response:: NonErrorResponse ;
2324use scylla_cql:: types:: serialize:: batch:: BatchValues ;
@@ -798,6 +799,7 @@ impl Session {
798799 self . handle_auto_await_schema_agreement ( & response) . await ?;
799800
800801 let ( result, paging_state) = response. into_query_result_and_paging_state ( ) ?;
802+ span. record_result_fields ( & result) ;
801803 let result = result. into_legacy_result ( ) ?;
802804 Ok ( ( result, paging_state) )
803805 }
@@ -1235,6 +1237,7 @@ impl Session {
12351237 self . handle_auto_await_schema_agreement ( & response) . await ?;
12361238
12371239 let ( result, paging_state) = response. into_query_result_and_paging_state ( ) ?;
1240+ span. record_result_fields ( & result) ;
12381241 let result = result. into_legacy_result ( ) ?;
12391242 Ok ( ( result, paging_state) )
12401243 }
@@ -1430,8 +1433,12 @@ impl Session {
14301433
14311434 let result = match run_query_result {
14321435 RunQueryResult :: IgnoredWriteError => LegacyQueryResult :: mock_empty ( ) ,
1433- RunQueryResult :: Completed ( response) => response. into_legacy_result ( ) ?,
1436+ RunQueryResult :: Completed ( result) => {
1437+ span. record_result_fields ( & result) ;
1438+ result. into_legacy_result ( ) ?
1439+ }
14341440 } ;
1441+
14351442 Ok ( result)
14361443 }
14371444
@@ -2150,6 +2157,17 @@ impl RequestSpan {
21502157 }
21512158 }
21522159
2160+ pub ( crate ) fn record_raw_rows_fields ( & self , raw_rows : & RawMetadataAndRawRows ) {
2161+ self . span
2162+ . record ( "raw_result_size" , raw_rows. metadata_and_rows_bytes_size ( ) ) ;
2163+ }
2164+
2165+ pub ( crate ) fn record_result_fields ( & self , query_result : & QueryResult ) {
2166+ if let Some ( raw_metadata_and_rows) = query_result. raw_metadata_and_rows ( ) {
2167+ self . record_raw_rows_fields ( raw_metadata_and_rows) ;
2168+ }
2169+ }
2170+
21532171 pub ( crate ) fn record_replicas < ' a > ( & ' a self , replicas : & ' a [ ( impl Borrow < Arc < Node > > , Shard ) ] ) {
21542172 struct ReplicaIps < ' a , N > ( & ' a [ ( N , Shard ) ] ) ;
21552173 impl < ' a , N > Display for ReplicaIps < ' a , N >
0 commit comments