@@ -2,6 +2,7 @@ use std::sync::{Arc, Mutex};
22use std:: time:: { Duration , Instant } ;
33
44use serde:: Deserialize ;
5+ use tracing:: { error, warn} ;
56use url:: Url ;
67
78use super :: clock:: { system_clock, Clock } ;
@@ -231,6 +232,7 @@ impl NetworkApiClient {
231232 let url = match base_url. join ( "internal/validate" ) {
232233 Ok ( u) => u,
233234 Err ( _) => {
235+ error ! ( "failed to build /internal/validate URL" ) ;
234236 permit. record_failure ( ) ;
235237 return ValidateResult :: FailOpen ;
236238 }
@@ -273,7 +275,8 @@ impl NetworkApiClient {
273275 expires_at,
274276 }
275277 }
276- Err ( _) => {
278+ Err ( err) => {
279+ error ! ( %err, "malformed /internal/validate 200 body" ) ;
277280 VALIDATE_CALL_TOTAL . with_label_values ( & [ "fail_open" ] ) . inc ( ) ;
278281 permit. record_failure ( ) ;
279282 ValidateResult :: FailOpen
@@ -302,12 +305,20 @@ impl NetworkApiClient {
302305 // Looks like a non-API 404 (misrouted, gateway error
303306 // page, etc.). Fail open so a deployment problem
304307 // doesn't masquerade as a flood of revoked keys.
308+ error ! ( "/internal/validate returned non-JSON 404" ) ;
305309 VALIDATE_CALL_TOTAL . with_label_values ( & [ "fail_open" ] ) . inc ( ) ;
306310 permit. record_failure ( ) ;
307311 ValidateResult :: FailOpen
308312 }
309313 }
310- _ => {
314+ Ok ( r) => {
315+ warn ! ( status = %r. status( ) , "/internal/validate returned unexpected HTTP status" ) ;
316+ VALIDATE_CALL_TOTAL . with_label_values ( & [ "fail_open" ] ) . inc ( ) ;
317+ permit. record_failure ( ) ;
318+ ValidateResult :: FailOpen
319+ }
320+ Err ( err) => {
321+ warn ! ( %err, "/internal/validate transport failure" ) ;
311322 VALIDATE_CALL_TOTAL . with_label_values ( & [ "fail_open" ] ) . inc ( ) ;
312323 permit. record_failure ( ) ;
313324 ValidateResult :: FailOpen
0 commit comments