-
Notifications
You must be signed in to change notification settings - Fork 519
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(glean): add is_baseline metric to pings #9476
Conversation
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.
@LeoMcA: Code looks fine. Should we go for a string instead of a bool. It seems like baseline will not really be binary.
This pull request has merge conflicts that must be resolved before it can be merged. |
True, I ummed and ahhed over this - while baseline itself will still be boolean, we will probably be exposing more of a ternary to users (baseline, nearly baseline, not baseline), and I think there's value in measuring what that status we surface to users is. I'll make the change. |
Updated to use string instead of boolean, new example glean pings:
|
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.
Looks good! One nit if even.
isBaseline: | ||
doc?.baseline?.is_baseline === undefined | ||
? undefined | ||
: doc.baseline.is_baseline | ||
? "baseline" | ||
: "not_baseline", |
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.
some potential JS magic:
isBaseline: { undefined: undefined, true: "baseline", false: "no_baseline"}[doc?.baseline?.is_baseline]
or
isBaseline: { true: "baseline", false: "no_baseline"}[doc?.baseline?.is_baseline]
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.
Unfortunately typescript makes this less fun, as I have to manually cast doc?.baseline?.is_baseline
to a string:
isBaseline: { true: "baseline", false: "no_baseline" }[
String(doc?.baseline?.is_baseline)
],
So I'm going to leave as it is, especially since I imagine we'll need a second layer of logic for future the almost-baseline case, but I'll remember this for the future!
Summary
https://mozilla-hub.atlassian.net/browse/MP-542
https://bugzilla.mozilla.org/show_bug.cgi?id=1848187
Problem
While we could track page views with a baseline status by manually exporting a list of pages, and feeding that into our metrics tools, this doesn't scale very well.
Solution
Add an
is_baseline
metric to page views and events:null
- no baseline status on the pagetrue
- the page is baselinefalse
- the page is not baselineAlso update the CSP to allow sending glean pings from localhost:5042
How did you test this change?
set:
run:
yarn && yarn dev
to test the null case:
to test the true case:
to test the false case: