Skip to content
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

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

jrconlin
Copy link
Member

@jrconlin jrconlin commented Aug 3, 2023

Closes: SYNC-3842

@jrconlin jrconlin marked this pull request as ready for review August 11, 2023 21:00
@jrconlin jrconlin requested a review from pjenvey August 11, 2023 21:01
// 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() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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());
Copy link
Member

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

Comment on lines +108 to +117
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)
Copy link
Member

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 existing notification.auth metric (moving all this into parse_vapid)?
  • If it doesn't make sense as part of parse_vapid I think ideally this extra work for metrics shouldn't occur until validate_vapid_jwt succeeds in validating
  • Is the new notification.auth.ok totally necessary? We emit updates.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:") {
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants