Add an index-per-type histogram for awesomebar results (bug 1345834). data-review=bsmedberg r=adw,bsmedberg

MozReview-Commit-ID: HxqENFSYcJy

--HG--
extra : rebase_source : b7bdbc6cdd6d67ed633b19b36418e3272a3f96e5
This commit is contained in:
Panos Astithas 2017-04-05 17:51:41 +03:00
Родитель a1d114de50
Коммит aa73212e5b
3 изменённых файлов: 41 добавлений и 4 удалений

Просмотреть файл

@ -259,16 +259,15 @@ let urlbarListener = {
.getHistogramById("FX_URLBAR_SELECTED_RESULT_INDEX")
.add(idx);
// Ideally this would be a keyed histogram and we'd just add(actionType),
// but keyed histograms aren't currently shown on the telemetry dashboard
// (bug 1151756).
//
// You can add values but don't change any of the existing values.
// Otherwise you'll break our data.
if (actionType in URLBAR_SELECTED_RESULT_TYPES) {
Services.telemetry
.getHistogramById("FX_URLBAR_SELECTED_RESULT_TYPE")
.add(URLBAR_SELECTED_RESULT_TYPES[actionType]);
Services.telemetry
.getKeyedHistogramById("FX_URLBAR_SELECTED_RESULT_INDEX_BY_TYPE")
.add(actionType, idx);
} else {
Cu.reportError("Unknown FX_URLBAR_SELECTED_RESULT_TYPE type: " +
actionType);

Просмотреть файл

@ -102,6 +102,8 @@ add_task(function* test_simpleQuery() {
Services.telemetry.clearEvents();
let resultIndexHist = Services.telemetry.getHistogramById("FX_URLBAR_SELECTED_RESULT_INDEX");
let resultTypeHist = Services.telemetry.getHistogramById("FX_URLBAR_SELECTED_RESULT_TYPE");
let resultIndexByTypeHist = Services.telemetry.getKeyedHistogramById("FX_URLBAR_SELECTED_RESULT_INDEX_BY_TYPE");
resultIndexByTypeHist.clear();
resultIndexHist.clear();
resultTypeHist.clear();
@ -138,6 +140,11 @@ add_task(function* test_simpleQuery() {
URLBAR_SELECTED_RESULT_TYPES.searchengine,
"FX_URLBAR_SELECTED_RESULT_TYPE");
let resultIndexByType = resultIndexByTypeHist.snapshot("searchengine");
checkHistogramResults(resultIndexByType,
0,
"FX_URLBAR_SELECTED_RESULT_INDEX_BY_TYPE");
yield BrowserTestUtils.removeTab(tab);
});
@ -147,6 +154,8 @@ add_task(function* test_searchAlias() {
Services.telemetry.clearEvents();
let resultIndexHist = Services.telemetry.getHistogramById("FX_URLBAR_SELECTED_RESULT_INDEX");
let resultTypeHist = Services.telemetry.getHistogramById("FX_URLBAR_SELECTED_RESULT_TYPE");
let resultIndexByTypeHist = Services.telemetry.getKeyedHistogramById("FX_URLBAR_SELECTED_RESULT_INDEX_BY_TYPE");
resultIndexByTypeHist.clear();
resultIndexHist.clear();
resultTypeHist.clear();
@ -183,6 +192,11 @@ add_task(function* test_searchAlias() {
URLBAR_SELECTED_RESULT_TYPES.searchengine,
"FX_URLBAR_SELECTED_RESULT_TYPE");
let resultIndexByType = resultIndexByTypeHist.snapshot("searchengine");
checkHistogramResults(resultIndexByType,
0,
"FX_URLBAR_SELECTED_RESULT_INDEX_BY_TYPE");
yield BrowserTestUtils.removeTab(tab);
});
@ -192,6 +206,8 @@ add_task(function* test_oneOff() {
Services.telemetry.clearEvents();
let resultIndexHist = Services.telemetry.getHistogramById("FX_URLBAR_SELECTED_RESULT_INDEX");
let resultTypeHist = Services.telemetry.getHistogramById("FX_URLBAR_SELECTED_RESULT_TYPE");
let resultIndexByTypeHist = Services.telemetry.getKeyedHistogramById("FX_URLBAR_SELECTED_RESULT_INDEX_BY_TYPE");
resultIndexByTypeHist.clear();
resultIndexHist.clear();
resultTypeHist.clear();
@ -231,6 +247,11 @@ add_task(function* test_oneOff() {
URLBAR_SELECTED_RESULT_TYPES.searchengine,
"FX_URLBAR_SELECTED_RESULT_TYPE");
let resultIndexByType = resultIndexByTypeHist.snapshot("searchengine");
checkHistogramResults(resultIndexByType,
0,
"FX_URLBAR_SELECTED_RESULT_INDEX_BY_TYPE");
yield BrowserTestUtils.removeTab(tab);
});
@ -240,6 +261,8 @@ add_task(function* test_suggestion() {
Services.telemetry.clearEvents();
let resultIndexHist = Services.telemetry.getHistogramById("FX_URLBAR_SELECTED_RESULT_INDEX");
let resultTypeHist = Services.telemetry.getHistogramById("FX_URLBAR_SELECTED_RESULT_TYPE");
let resultIndexByTypeHist = Services.telemetry.getKeyedHistogramById("FX_URLBAR_SELECTED_RESULT_INDEX_BY_TYPE");
resultIndexByTypeHist.clear();
resultIndexHist.clear();
resultTypeHist.clear();
@ -291,6 +314,11 @@ add_task(function* test_suggestion() {
URLBAR_SELECTED_RESULT_TYPES.searchsuggestion,
"FX_URLBAR_SELECTED_RESULT_TYPE");
let resultIndexByType = resultIndexByTypeHist.snapshot("searchsuggestion");
checkHistogramResults(resultIndexByType,
3,
"FX_URLBAR_SELECTED_RESULT_INDEX_BY_TYPE");
Services.search.currentEngine = previousEngine;
Services.search.removeEngine(suggestionEngine);
yield BrowserTestUtils.removeTab(tab);

Просмотреть файл

@ -5916,6 +5916,16 @@
"bug_numbers": [775825],
"description": "Firefox: The type of the selected result in the URL bar popup. See BrowserUsageTelemetry.jsm:URLBAR_SELECTED_RESULT_TYPES for the result types."
},
"FX_URLBAR_SELECTED_RESULT_INDEX_BY_TYPE": {
"alert_emails": ["firefox-dev@mozilla.org"],
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 14,
"keyed": true,
"releaseChannelCollection": "opt-out",
"bug_numbers": [1345834],
"description": "Firefox: The index of the selected result in the URL bar popup by the type of the selected result in the URL bar popup. See BrowserUsageTelemetry.jsm:URLBAR_SELECTED_RESULT_TYPES for the result types."
},
"INNERWINDOWS_WITH_MUTATION_LISTENERS": {
"expires_in_version": "never",
"kind": "boolean",