-
Notifications
You must be signed in to change notification settings - Fork 113
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
Add metric count
evolution plot; fixes #312.
#335
Conversation
The live link looks great! Before I get into the code: generally big refactors are less useful that they appear. There's a lot to be gained by treating every unfamiliar line of code as the fix to a bug we didn't even see. That being said, these dashboards were coded rapidly, so there's probably some easy wins a refactor could provide :) To your side question: "ping count" is only counting pings that contain the probe. "sample count" is the number of measurements. So two pings with histogram Those links you provide are likely a bug. Thanks for catching them! Thanks to your report @fbertsch is now looking into it. |
new-pipeline/src/evo.js
Outdated
} : function (y) { | ||
return y; | ||
}, | ||
yax_format: (y => y + valueSuffux), |
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 coerces y to a string which, for counts like submissions and metric counts, means the formatter can't automatically translate the y-ticks from, say, 150000 to 150k.
new-pipeline/src/evo.js
Outdated
@@ -703,6 +703,8 @@ function getHistogramEvolutionLines(channel, version, measure, aggregates, | |||
} | |||
|
|||
function displayEvolution(target, lines, usePercentages, plotOptions) { | |||
let valueSuffux = usePercentages ? "%" : ""; |
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.
s/Suffux/Suffix/g
new-pipeline/src/evo.js
Outdated
@@ -825,11 +814,9 @@ function displayEvolution(target, lines, usePercentages, plotOptions) { | |||
var x = parseInt(rolloverCircle.getAttribute("cx")) + 20, | |||
y = 40; | |||
var bbox = legend[0][0].getBBox(); | |||
if (x + bbox.width + 50 > $(`${target} svg`) | |||
.width()) x -= bbox.width + 40; | |||
if (x + bbox.width + 50 > $(`${target} svg`).width()) x -= bbox.width + 40; |
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.
The style we're aspiring to use recommends three-line conditionals
if (cond) {
...body...
}
new-pipeline/src/evo.js
Outdated
d3.select(`${target} .mg-active-datapoint-container`) | ||
.attr("transform", "translate(" + (x + bbox.width) + "," + (y + | ||
15) + ")"); | ||
.attr("transform", "translate(" + (x + bbox.width) + "," + (y + 15) + ")"); |
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.
More concise as a template string?
translate(${x + bbox.width}, ${y + 15})
new-pipeline/src/evo.js
Outdated
@@ -25,10 +24,14 @@ var gDefaultAggregates = [ | |||
["95th-percentile", "95th percentile", function (evolution) { | |||
return evolution.percentiles(95); | |||
}], | |||
]; | |||
// these will not appear in the multiselect |
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.
I'm not sure if anyone uses it, but being able to have the submissions on the same plot instead of just on the linked plot below might support use cases requiring a more closer scrutiny of submissions vs values. For now I recommend leaving it in the multiselect.
new-pipeline/src/evo.js
Outdated
indicate("Rendering evolutions..."); | ||
|
||
var submissionLines = lines.filter(line => line.aggregate == "Submissions"); |
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.
I'm not the biggest fan of magic strings. Can we at least pull this out to a constant? Or if you can think of something more clever, I'd like that too :)
new-pipeline/src/evo.js
Outdated
var submissionLines = lines.filter(line => line.aggregate == "Submissions"); | ||
|
||
let metaAggregateNames = gMetaAggregates.map(entry => entry[1]); | ||
lines = lines.filter(line => !metaAggregateNames.includes(line.aggregate)); |
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 imposes a constraint that aggregates and metaAggregates cannot share the same name. Not likely to come up, but you should put it in a comment up near gMetaAggregates.
new-pipeline/src/evo.js
Outdated
displayEvolution('#metric-count', countLines, false, { | ||
height: 300, | ||
x_label: variableLabel, | ||
y_label: "Daily Metric Coun", |
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.
missing a "t"
v2/telemetry.js
Outdated
@@ -312,6 +312,10 @@ | |||
}); | |||
}; | |||
|
|||
Evolution.prototype.metric_count = function () { |
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.
telemetry.js uses camelCase
for its API names.
Speaking of which, if you're adding to the API you need to add to the documentation. telemetry.js is used in a few places by a few teams and individuals. Keeping the documentation up-to-date is of utmost importance.
We've found out the problem that was showing you ping count > sample count. It's an obscure Telemetry client bug that you need not concern yourself about the details... the closest tl;dr I can give is: we were sending blank histograms for every ping after the first one for that probe (and others like it) which resulted in higher ping counts than sample counts. The bug was noticed and fixed as a part of a large refactor in the middle of Nightly 56 which is why data from 57 and 58 do not exhibit this character. Thanks again for catching it! |
Pushed updated commits. After discussion on IRC, dropped this comment. Renamed "metric count" to "sample count", as "sample" seemed to already be used in the UI and docs. |
Is the new code being served properly at the "After" link? I keep refreshing and the lower graphs keep having y-axis ticks that are full of 0s instead of being automagically shortened to things like 150k... |
Also hide submissionLines from the multiselect, as it's always shown on the bottom
Also added sampleCount() to Evolution.
Oh, turns out the old code had a small bug too.
Turns out even just Fixed it here. |
Looks good to me! Let's get this in production. (It should show up within the next half hour. Possibly faster) |
Fixes #312.
Before: link
After: link
Changes:
To consider:
Sample Count
value in Distribution View), but it'd be nice if you made sure I did it right (see side question below)Side question: sometimes/often
metric count
<ping count
. For example distribution, evolution. I don't get why exactly this can happen. Does the server report all pings in the time range, even if they didn't have this value? (which also seems a bit strange, since 1. that would mean theping count
should be equal between metrics, but it isn't, and 2. being default browser is probably checked fairly early on?)