Skip to content

Commit

Permalink
feat: Reduce some of the more common errors from the logs (#695)
Browse files Browse the repository at this point in the history
Reduces some of the less useful errors from the stdout logs.

* Fixes the Bad Aud to be shorter, clearer

Closes SYNC-4243
  • Loading branch information
jrconlin authored Apr 30, 2024
1 parent d49458e commit 444f82a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
10 changes: 8 additions & 2 deletions autoendpoint/src/extractors/subscription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ impl FromRequest for Subscription {
.fernet
.decrypt(&repad_base64(&token_info.token))
.map_err(|e| {
error!("🔐 fernet: {:?}", e);
// Since we're decrypting and endpoint, we get a lot of spam links.
// This can fill our logs.
trace!("🔐 fernet: {:?}", e);
ApiErrorKind::InvalidToken
})?;

Expand Down Expand Up @@ -336,7 +338,11 @@ fn validate_vapid_jwt(
};

if domain != &aud {
error!("Bad Aud: I am <{:?}>, asked for <{:?}> ", domain, aud);
info!(
"Bad Aud: I am <{:?}>, asked for <{:?}> ",
domain.as_str(),
token_data.claims.aud
);
metrics.clone().incr("notification.auth.bad_vapid.domain");
return Err(VapidError::InvalidAudience.into());
}
Expand Down
14 changes: 13 additions & 1 deletion autoendpoint/src/routers/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ pub async fn handle_error(
);
}
RouterError::RequestTimeout => {
warn!("Bridge timeout");
// Bridge timeouts are common.
info!("Bridge timeout");
incr_error_metric(
metrics,
platform,
Expand Down Expand Up @@ -116,6 +117,17 @@ pub async fn handle_error(
error.errno(),
);
}
RouterError::TooMuchData(_) => {
// Do not log this error since it's fairly common.
incr_error_metric(
metrics,
platform,
app_id,
"too_much_data",
error.status(),
error.errno(),
);
}
_ => {
warn!("Unknown error while sending bridge request: {}", error);
incr_error_metric(
Expand Down

0 comments on commit 444f82a

Please sign in to comment.