-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add VAPID quality tracking metric messages #417
base: master
Are you sure you want to change the base?
Conversation
… feat/SYNC-3842_metrics
… feat/SYNC-3842_metrics
… feat/SYNC-3842_metrics
… feat/SYNC-3842_metrics
… feat/SYNC-3842_metrics
// Capturing the vapid sub right now will cause too much cardinality. Instead, | ||
// let's just capture if we have a valid VAPID, as well as what sort of bad sub | ||
// values we get. | ||
if let Some(header) = vapid.clone() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if let Some(header) = vapid.clone() { | |
if let Some(ref header) = vapid { |
@@ -298,7 +326,12 @@ fn validate_vapid_jwt( | |||
return Err(VapidError::InvalidVapid(e.to_string()).into()); | |||
} | |||
_ => { | |||
metrics.clone().incr("notification.auth.bad_vapid.other"); | |||
let mut tags = Tags::default(); | |||
tags.tags.insert("error".to_owned(), e.to_string()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't a suitable tag value, lots of their error variants produce strings with whitespace
tags.tags | ||
.insert("error".to_owned(), e.as_metric().to_owned()); | ||
metrics | ||
.clone() | ||
.incr_with_tags("notification.auth.error", Some(tags)); | ||
}) | ||
.unwrap_or_default(); | ||
// For now, record that we had a good (?) VAPID sub, | ||
metrics.clone().incr("notification.auth.ok"); | ||
info!("VAPID sub: {:?}", sub) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few things here:
- The lack of
sub
isn't really an actual error, maybe call this metric something else? Could it be a tag on the existingnotification.auth
metric (moving all this intoparse_vapid
)? - If it doesn't make sense as part of
parse_vapid
I think ideally this extra work for metrics shouldn't occur untilvalidate_vapid_jwt
succeeds in validating - Is the new
notification.auth.ok
totally necessary? We emitupdates.vapid.draft{version}
for successfully validated vapid, we could get a similar number by subtracting the no sub metric from those 2 combined
|
||
if let Some(sub_candiate) = data.get("sub") { | ||
if let Some(sub) = sub_candiate.as_str() { | ||
if !sub.starts_with("mailto:") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently https
is also valid?
Closes: SYNC-3842