mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 07:15:46 +00:00
Bug 1231812 - Don't send empty keyed histograms in Telemetry pings. r=gfritzsche
MozReview-Commit-ID: 2Vl3IjjeaHj
This commit is contained in:
parent
cb1ed695b4
commit
51d726419d
@ -961,7 +961,6 @@ var Impl = {
|
||||
this._log.trace("getKeyedHistograms - Skipping test histogram: " + id);
|
||||
continue;
|
||||
}
|
||||
ret[id] = {};
|
||||
let keyed = Telemetry.getKeyedHistogramById(id);
|
||||
let snapshot = null;
|
||||
if (subsession) {
|
||||
@ -970,7 +969,15 @@ var Impl = {
|
||||
} else {
|
||||
snapshot = keyed.snapshot();
|
||||
}
|
||||
for (let key of Object.keys(snapshot)) {
|
||||
|
||||
let keys = Object.keys(snapshot);
|
||||
if (keys.length == 0) {
|
||||
// Skip empty keyed histogram.
|
||||
continue;
|
||||
}
|
||||
|
||||
ret[id] = {};
|
||||
for (let key of keys) {
|
||||
ret[id][key] = this.packHistogram(snapshot[key]);
|
||||
}
|
||||
}
|
||||
|
@ -178,7 +178,9 @@ This section contains the histograms that are valid for the current platform. ``
|
||||
|
||||
keyedHistograms
|
||||
---------------
|
||||
This section contains the keyed histograms available for the current platform. Unlike the ``histograms`` section, this section always reports all the keyed histograms, even though they contain no data.
|
||||
This section contains the keyed histograms available for the current platform.
|
||||
|
||||
As of Firefox 48, this section does not contain empty keyed histograms anymore.
|
||||
|
||||
threadHangStats
|
||||
---------------
|
||||
|
@ -365,11 +365,9 @@ function checkPayload(payload, reason, successfulPings, savedPings) {
|
||||
|
||||
Assert.ok("keyedHistograms" in payload);
|
||||
let keyedHistograms = payload.keyedHistograms;
|
||||
Assert.ok(TELEMETRY_TEST_KEYED_FLAG in keyedHistograms);
|
||||
Assert.ok(!(TELEMETRY_TEST_KEYED_FLAG in keyedHistograms));
|
||||
Assert.ok(TELEMETRY_TEST_KEYED_COUNT in keyedHistograms);
|
||||
|
||||
Assert.deepEqual({}, keyedHistograms[TELEMETRY_TEST_KEYED_FLAG]);
|
||||
|
||||
const expected_keyed_count = {
|
||||
"a": {
|
||||
range: [1, 2],
|
||||
@ -643,10 +641,8 @@ add_task(function* test_checkSubsessionHistograms() {
|
||||
Assert.equal(subsession.info.reason, "environment-change");
|
||||
Assert.ok(!(COUNT_ID in classic.histograms));
|
||||
Assert.ok(!(COUNT_ID in subsession.histograms));
|
||||
Assert.ok(KEYED_ID in classic.keyedHistograms);
|
||||
Assert.ok(KEYED_ID in subsession.keyedHistograms);
|
||||
Assert.deepEqual(classic.keyedHistograms[KEYED_ID], {});
|
||||
Assert.deepEqual(subsession.keyedHistograms[KEYED_ID], {});
|
||||
Assert.ok(!(KEYED_ID in classic.keyedHistograms));
|
||||
Assert.ok(!(KEYED_ID in subsession.keyedHistograms));
|
||||
|
||||
checkHistograms(classic.histograms, subsession.histograms);
|
||||
checkKeyedHistograms(classic.keyedHistograms, subsession.keyedHistograms);
|
||||
@ -677,9 +673,8 @@ add_task(function* test_checkSubsessionHistograms() {
|
||||
|
||||
Assert.ok(!(COUNT_ID in classic.histograms));
|
||||
Assert.ok(!(COUNT_ID in subsession.histograms));
|
||||
Assert.ok(KEYED_ID in classic.keyedHistograms);
|
||||
Assert.ok(KEYED_ID in subsession.keyedHistograms);
|
||||
Assert.deepEqual(classic.keyedHistograms[KEYED_ID], {});
|
||||
Assert.ok(!(KEYED_ID in classic.keyedHistograms));
|
||||
Assert.ok(!(KEYED_ID in subsession.keyedHistograms));
|
||||
|
||||
checkHistograms(classic.histograms, subsession.histograms);
|
||||
checkKeyedHistograms(classic.keyedHistograms, subsession.keyedHistograms);
|
||||
@ -725,10 +720,9 @@ add_task(function* test_checkSubsessionHistograms() {
|
||||
Assert.equal(subsession.histograms[COUNT_ID].sum, 0);
|
||||
|
||||
Assert.ok(KEYED_ID in classic.keyedHistograms);
|
||||
Assert.ok(KEYED_ID in subsession.keyedHistograms);
|
||||
Assert.ok(!(KEYED_ID in subsession.keyedHistograms));
|
||||
Assert.equal(classic.keyedHistograms[KEYED_ID]["a"].sum, 1);
|
||||
Assert.equal(classic.keyedHistograms[KEYED_ID]["b"].sum, 1);
|
||||
Assert.deepEqual(subsession.keyedHistograms[KEYED_ID], {});
|
||||
|
||||
// Adding values should get picked up in both again.
|
||||
count.add(1);
|
||||
@ -872,7 +866,7 @@ add_task(function* test_dailyCollection() {
|
||||
Assert.equal(subsessionStartDate.toISOString(), expectedDate.toISOString());
|
||||
|
||||
Assert.equal(ping.payload.histograms[COUNT_ID].sum, 0);
|
||||
Assert.deepEqual(ping.payload.keyedHistograms[KEYED_ID], {});
|
||||
Assert.ok(!(KEYED_ID in ping.payload.keyedHistograms));
|
||||
|
||||
// Trigger and collect another daily ping, with the histograms being set again.
|
||||
count.add(1);
|
||||
@ -1079,7 +1073,7 @@ add_task(function* test_environmentChange() {
|
||||
Assert.equal(subsessionStartDate.toISOString(), startDay.toISOString());
|
||||
|
||||
Assert.equal(ping.payload.histograms[COUNT_ID].sum, 0);
|
||||
Assert.deepEqual(ping.payload.keyedHistograms[KEYED_ID], {});
|
||||
Assert.ok(!(KEYED_ID in ping.payload.keyedHistograms));
|
||||
});
|
||||
|
||||
add_task(function* test_savedPingsOnShutdown() {
|
||||
|
Loading…
Reference in New Issue
Block a user