File tree Expand file tree Collapse file tree 2 files changed +24
-4
lines changed
crates/notary/server/src/service Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ use axum_core::body::Body;
77use hyper:: upgrade:: { OnUpgrade , Upgraded } ;
88use hyper_util:: rt:: TokioIo ;
99use std:: future:: Future ;
10+ use tokio:: time:: Instant ;
1011use tracing:: { debug, error, info} ;
1112
1213use crate :: { domain:: notary:: NotaryGlobals , service:: notary_service, NotaryServerError } ;
@@ -84,13 +85,22 @@ pub async fn tcp_notarize(
8485 notary_globals : NotaryGlobals ,
8586 session_id : String ,
8687) {
88+ let start = Instant :: now ( ) ;
8789 debug ! ( ?session_id, "Upgraded to tcp connection" ) ;
8890 match notary_service ( stream, notary_globals, & session_id) . await {
8991 Ok ( _) => {
90- info ! ( ?session_id, "Successful notarization using tcp!" ) ;
92+ info ! (
93+ ?session_id,
94+ elapsed_time_millis = start. elapsed( ) . as_millis( ) ,
95+ "Successful notarization using tcp!"
96+ ) ;
9197 }
9298 Err ( err) => {
93- error ! ( ?session_id, "Failed notarization using tcp: {err}" ) ;
99+ error ! (
100+ ?session_id,
101+ elapsed_time_millis = start. elapsed( ) . as_millis( ) ,
102+ "Failed notarization using tcp: {err}"
103+ ) ;
94104 }
95105 }
96106}
Original file line number Diff line number Diff line change 1+ use tokio:: time:: Instant ;
12use tracing:: { debug, error, info} ;
23use ws_stream_tungstenite:: WsStream ;
34
@@ -12,16 +13,25 @@ pub async fn websocket_notarize(
1213 notary_globals : NotaryGlobals ,
1314 session_id : String ,
1415) {
16+ let start = Instant :: now ( ) ;
1517 debug ! ( ?session_id, "Upgraded to websocket connection" ) ;
1618 // Wrap the websocket in WsStream so that we have AsyncRead and AsyncWrite
1719 // implemented
1820 let stream = WsStream :: new ( socket. into_inner ( ) ) ;
1921 match notary_service ( stream, notary_globals, & session_id) . await {
2022 Ok ( _) => {
21- info ! ( ?session_id, "Successful notarization using websocket!" ) ;
23+ info ! (
24+ ?session_id,
25+ elapsed_time_millis = start. elapsed( ) . as_millis( ) ,
26+ "Successful notarization using websocket!"
27+ ) ;
2228 }
2329 Err ( err) => {
24- error ! ( ?session_id, "Failed notarization using websocket: {err}" ) ;
30+ error ! (
31+ ?session_id,
32+ elapsed_time_millis = start. elapsed( ) . as_millis( ) ,
33+ "Failed notarization using websocket: {err}"
34+ ) ;
2535 }
2636 }
2737}
You can’t perform that action at this time.
0 commit comments