@@ -310,7 +310,7 @@ async fn handle_request<
310310 . await
311311 {
312312 Ok ( auth_response) => {
313- tracing:: info!( "Authentication successful" ) ;
313+ tracing:: info!( user_token = %auth_response . user_token , "Authentication successful" ) ;
314314 auth_response. user_token
315315 } ,
316316 Err ( e) => {
@@ -329,7 +329,7 @@ async fn handle_request<
329329 Err ( _) => {
330330 Span :: current ( ) . record ( "http.status_code" , 413 ) ;
331331 Span :: current ( ) . record ( "error" , true ) ;
332- tracing:: warn!( http. status_code = 413 , "Request body too large" ) ;
332+ tracing:: warn!( user_token = %user_token , http. status_code = 413 , "Request body too large" ) ;
333333 return Ok ( Response :: builder ( )
334334 . status ( StatusCode :: PAYLOAD_TOO_LARGE )
335335 . body ( Full :: new ( Bytes :: from ( "Request body too large" ) ) )
@@ -342,12 +342,13 @@ async fn handle_request<
342342 Span :: current ( ) . record ( "http.request.body.size" , bytes. len ( ) ) ;
343343
344344 match T :: decode ( bytes) {
345- Ok ( request) => match handler ( store. clone ( ) , user_token, request) . await {
345+ Ok ( request) => match handler ( store. clone ( ) , user_token. clone ( ) , request) . await {
346346 Ok ( response) => {
347347 let response_bytes = response. encode_to_vec ( ) ;
348348 Span :: current ( ) . record ( "http.response.body.size" , response_bytes. len ( ) ) ;
349349 Span :: current ( ) . record ( "http.status_code" , 200 ) ;
350350 tracing:: info!(
351+ user_token = %user_token,
351352 http. status_code = 200 ,
352353 operation = operation_name,
353354 "Request completed successfully"
@@ -365,35 +366,35 @@ async fn handle_request<
365366 match & e {
366367 VssError :: InternalServerError ( msg) => {
367368 sentry:: capture_message (
368- & format ! ( "Internal server error: {}" , msg) ,
369+ & format ! ( "Internal server error for user_token {} : {}" , user_token , msg) ,
369370 sentry:: Level :: Error ,
370371 ) ;
371- tracing:: error!( error = %e, http. status_code = status_code, "Internal server error" ) ;
372+ tracing:: error!( user_token = %user_token , error = %e, http. status_code = status_code, "Internal server error" ) ;
372373 } ,
373374 VssError :: NoSuchKeyError ( _) => {
374375 // NoSuchKeyError is a normal case when a key doesn't exist (404).
375376 // Don't send these to Sentry as they're expected errors.
376- tracing:: info!( error = %e, http. status_code = status_code, "Key not found" ) ;
377+ tracing:: info!( user_token = %user_token , error = %e, http. status_code = status_code, "Key not found" ) ;
377378 } ,
378379 _ => {
379380 sentry:: capture_message (
380- & format ! ( "Request error: {}" , e) ,
381+ & format ! ( "Request error for user_token {} : {}" , user_token , e) ,
381382 sentry:: Level :: Warning ,
382383 ) ;
383- tracing:: warn!( error = %e, http. status_code = status_code, "Request error" ) ;
384+ tracing:: warn!( user_token = %user_token , error = %e, http. status_code = status_code, "Request error" ) ;
384385 } ,
385386 }
386387 Ok ( build_error_response ( e) )
387388 } ,
388389 } ,
389390 Err ( e) => {
390391 sentry:: capture_message (
391- & format ! ( "Error parsing protobuf request: {}" , e) ,
392+ & format ! ( "Error parsing protobuf request for user_token {} : {}" , user_token , e) ,
392393 sentry:: Level :: Warning ,
393394 ) ;
394395 Span :: current ( ) . record ( "http.status_code" , 400 ) ;
395396 Span :: current ( ) . record ( "error" , true ) ;
396- tracing:: warn!( error = %e, http. status_code = 400 , "Error parsing protobuf request" ) ;
397+ tracing:: warn!( user_token = %user_token , error = %e, http. status_code = 400 , "Error parsing protobuf request" ) ;
397398 Ok ( Response :: builder ( )
398399 . status ( StatusCode :: BAD_REQUEST )
399400 . body ( Full :: new ( Bytes :: from ( b"Error parsing request" . to_vec ( ) ) ) )
0 commit comments