Permalink
Browse files

Merge pull request #33567 from tamarahills/bugfix/Bug-1229083-AddonHi…

…stograms-missing-level

Bug 1229083 - Add missing level to AddonHistograms. r=marshall.
  • Loading branch information...
tamarahills committed Dec 22, 2015
2 parents 0c18d68 + f631b2a commit 2756c03ff64fca5aa1355dce576a5efd30e26ae3
Showing with 86 additions and 68 deletions.
  1. +14 −10 apps/system/js/advanced_telemetry.js
  2. +72 −58 apps/system/test/unit/advanced_telemetry_test.js
@@ -96,7 +96,7 @@
var array = longLine.match(/.{1,1000}/g);
// Output each chunk to the console
array.forEach(function (value) {
console.log(AT_DEBUG_PREFIX + value);
console.log(value);
});
} else {
// Its < what ADB can handle so just output it normally.
@@ -430,9 +430,10 @@
// Merge the new metrics into the old metrics and then transmit the
// result to the server.
function mergePayloads(payloadOld, payloadNew) {
mergeKeyed(payloadOld.keyedHistograms, payloadOld, payloadNew);
mergeLists(payloadOld.addonHistograms,
payloadNew.addonHistograms);
mergeHistogramType(payloadOld.keyedHistograms, payloadOld, payloadNew,
'keyedHistograms');
mergeHistogramType(payloadOld.addonHistograms, payloadOld, payloadNew,
'addonHistograms');
return payloadOld;
}
});
@@ -464,15 +465,15 @@
}
}
function mergeKeyed(keyedOldHist, payloadOld, payloadNew) {
function mergeHistogramType(oldHist, payloadOld, payloadNew, histType) {
var keyedOldMapKeys = new Map();
for (var keyOld in keyedOldHist) {
keyedOldMapKeys.set(keyOld, keyedOldHist[keyOld]);
for (var keyOld in oldHist) {
keyedOldMapKeys.set(keyOld, oldHist[keyOld]);
}
var keyedNew = payloadNew.keyedHistograms;
var keyedOld = payloadOld.keyedHistograms;
var keyedNew = payloadNew[histType];
var keyedOld = payloadOld[histType];
for (var keyNew in keyedNew) {
if (keyedOldMapKeys.has(keyNew)) {
mergeLists(keyedOld[keyNew], keyedNew[keyNew]);
@@ -574,7 +575,10 @@
// Pack the Addon Histograms.
for (var addon in nameAddonHist) {
nameAddonHist[addon] = this.packHistogram(nameAddonHist[addon]);
for (var hist in nameAddonHist[addon]) {
nameAddonHist[addon][hist] =
this.packHistogram(nameAddonHist[addon][hist]);
}
}
// Pack the Keyed Histograms.
@@ -65,15 +65,17 @@ suite('AdvancedTelemetry:', function() {
}
},
addonHistograms: {
COMM_SMS: {
min: 1,
max: 1000,
histogram_type:0,
sum:58,
log_sum: 10.935960054397583,
log_sum_squares: 29.95399808883667,
ranges: [0,1,2,5,12,29,70,170,412,1000],
counts:[0,0,0,0,4,0,0,0,0,0]
addon1: {
COMM_SMS: {
min: 1,
max: 1000,
histogram_type: 0,
sum: 58,
log_sum: 10.935960054397583,
log_sum_squares: 29.95399808883667,
ranges: [0, 1, 2, 5, 12, 29, 70, 170, 412, 1000],
counts: [0, 0, 0, 0, 4, 0, 0, 0, 0, 0]
}
}
}
};
@@ -158,25 +160,29 @@ suite('AdvancedTelemetry:', function() {
}
},
addonHistograms: {
COMM_SMS: {
min: 1,
max: 1000,
histogram_type:0,
sum:58,
log_sum: 10.935960054397583,
log_sum_squares: 29.95399808883667,
ranges: [0,1,2,5,12,29,70,170,412,1000],
counts:[0,0,0,0,4,0,0,0,0,0]
addon1: {
COMM_SMS: {
min: 1,
max: 1000,
histogram_type: 0,
sum: 58,
log_sum: 10.935960054397583,
log_sum_squares: 29.95399808883667,
ranges: [0, 1, 2, 5, 12, 29, 70, 170, 412, 1000],
counts: [0, 0, 0, 0, 4, 0, 0, 0, 0, 0]
}
},
COMM_DIALER: {
min: 1,
max: 1000,
histogram_type:0,
sum:58,
log_sum: 10.935960054397583,
log_sum_squares: 29.95399808883667,
ranges: [0,1,2,5,12,29,70,170,412,1000],
counts:[0,0,0,0,4,0,0,0,0,0]
addon2: {
COMM_DIALER: {
min: 1,
max: 1000,
histogram_type: 0,
sum: 58,
log_sum: 10.935960054397583,
log_sum_squares: 29.95399808883667,
ranges: [0, 1, 2, 5, 12, 29, 70, 170, 412, 1000],
counts: [0, 0, 0, 0, 4, 0, 0, 0, 0, 0]
}
}
}
};
@@ -241,20 +247,24 @@ suite('AdvancedTelemetry:', function() {
}
},
addonHistograms:{
COMM_SMS:{
min:1,max:1000,histogram_type:0,
sum:116,
log_sum:21.871920108795166,
log_sum_squares:59.90799617767334,
ranges:[0,1,2,5,12,29,70,170,412,1000],
counts:[0,0,0,0,8,0,0,0,0,0]},
COMM_DIALER:{
min:1,max:1000,histogram_type:0,
sum:58,
log_sum:10.935960054397583,
log_sum_squares:29.95399808883667,
ranges:[0,1,2,5,12,29,70,170,412,1000],
counts:[0,0,0,0,4,0,0,0,0,0]}
addon1: {
COMM_SMS: {
min: 1, max: 1000, histogram_type: 0,
sum: 116,
log_sum: 21.871920108795166,
log_sum_squares: 59.90799617767334,
ranges: [0, 1, 2, 5, 12, 29, 70, 170, 412, 1000],
counts: [0, 0, 0, 0, 8, 0, 0, 0, 0, 0]}
},
addon2: {
COMM_DIALER: {
min: 1, max: 1000, histogram_type: 0,
sum: 58,
log_sum: 10.935960054397583,
log_sum_squares: 29.95399808883667,
ranges: [0, 1, 2, 5, 12, 29, 70, 170, 412, 1000],
counts: [0, 0, 0, 0, 4, 0, 0, 0, 0, 0]}
}
}
};
@@ -342,15 +352,17 @@ suite('AdvancedTelemetry:', function() {
}
},
addonHistograms: {
rn_metric: {
min: 1,
max: 10000,
histogram_type: 1,
sum: 99,
sum_squares_lo: 9801,
sum_squares_hi: 0,
ranges: [0, 1, 1251, 2501, 3751, 5001, 6250, 7500, 8750, 10000],
counts: [0, 1, 0, 0, 0, 0, 0, 0, 0, 0]
addon3: {
rn_metric: {
min: 1,
max: 10000,
histogram_type: 1,
sum: 99,
sum_squares_lo: 9801,
sum_squares_hi: 0,
ranges: [0, 1, 1251, 2501, 3751, 5001, 6250, 7500, 8750, 10000],
counts: [0, 1, 0, 0, 0, 0, 0, 0, 0, 0]
}
}
}
}
@@ -387,14 +399,16 @@ suite('AdvancedTelemetry:', function() {
}
},
addonHistograms: {
rn_metric: {
range: [1, 10000],
bucket_count:10,
histogram_type:1,
values:{'0':0, '1':1, '1251':0},
sum: 99,
sum_squares_lo:9801,
sum_squares_hi:0
addon3: {
rn_metric: {
range: [1, 10000],
bucket_count: 10,
histogram_type: 1,
values: {'0': 0, '1': 1, '1251': 0},
sum: 99,
sum_squares_lo: 9801,
sum_squares_hi: 0
}
}
}
}

0 comments on commit 2756c03

Please sign in to comment.