Fix Bug 1483297 - Add search shortcut count to session stats (#4340)
This commit is contained in:
Родитель
b4046f78aa
Коммит
bff4635b97
|
@ -64,10 +64,15 @@ export class _TopSites extends React.PureComponent {
|
||||||
const topSites = this._getVisibleTopSites();
|
const topSites = this._getVisibleTopSites();
|
||||||
const topSitesIconsStats = countTopSitesIconsTypes(topSites);
|
const topSitesIconsStats = countTopSitesIconsTypes(topSites);
|
||||||
const topSitesPinned = topSites.filter(site => !!site.isPinned).length;
|
const topSitesPinned = topSites.filter(site => !!site.isPinned).length;
|
||||||
|
const searchShortcuts = topSites.filter(site => !!site.searchTopSite).length;
|
||||||
// Dispatch telemetry event with the count of TopSites images types.
|
// Dispatch telemetry event with the count of TopSites images types.
|
||||||
this.props.dispatch(ac.AlsoToMain({
|
this.props.dispatch(ac.AlsoToMain({
|
||||||
type: at.SAVE_SESSION_PERF_DATA,
|
type: at.SAVE_SESSION_PERF_DATA,
|
||||||
data: {topsites_icon_stats: topSitesIconsStats, topsites_pinned: topSitesPinned}
|
data: {
|
||||||
|
topsites_icon_stats: topSitesIconsStats,
|
||||||
|
topsites_pinned: topSitesPinned,
|
||||||
|
topsites_search_shortcuts: searchShortcuts
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -223,6 +223,7 @@ and losing focus. | :one:
|
||||||
| `rich_icon` | [Optional] Number of topsites that display a high quality favicon. | :one:
|
| `rich_icon` | [Optional] Number of topsites that display a high quality favicon. | :one:
|
||||||
| `no_image` | [Optional] Number of topsites that have no screenshot. | :one:
|
| `no_image` | [Optional] Number of topsites that have no screenshot. | :one:
|
||||||
| `topsites_pinned` | [Optional] Number of topsites that are pinned. | :one:
|
| `topsites_pinned` | [Optional] Number of topsites that are pinned. | :one:
|
||||||
|
| `topsites_search_shortcuts` | [Optional] Number of search shortcut topsites. | :one:
|
||||||
| `visibility_event_rcvd_ts` | [Optional][Server Counter][Server Alert for too many omissions] DOMHighResTimeStamp of when the page itself receives an event that document.visibilityState == visible. | :one:
|
| `visibility_event_rcvd_ts` | [Optional][Server Counter][Server Alert for too many omissions] DOMHighResTimeStamp of when the page itself receives an event that document.visibilityState == visible. | :one:
|
||||||
| `tiles` | [Required] A list of tile objects for the Pocket articles. Each tile object mush have a ID, and optionally a "pos" property to indicate the tile position | :one:
|
| `tiles` | [Required] A list of tile objects for the Pocket articles. Each tile object mush have a ID, and optionally a "pos" property to indicate the tile position | :one:
|
||||||
| `click` | [Optional] An integer to record the 0-based index when user clicks on a Pocket tile. | :one:
|
| `click` | [Optional] An integer to record the 0-based index when user clicks on a Pocket tile. | :one:
|
||||||
|
|
|
@ -439,6 +439,9 @@ perf: {
|
||||||
// The number of Top Sites that are pinned.
|
// The number of Top Sites that are pinned.
|
||||||
"topsites_pinned": 3,
|
"topsites_pinned": 3,
|
||||||
|
|
||||||
|
// The number of search shortcut Top Sites.
|
||||||
|
"topsites_search_shortcuts": 2,
|
||||||
|
|
||||||
// How much longer the data took, in milliseconds, to be ready for display
|
// How much longer the data took, in milliseconds, to be ready for display
|
||||||
// than it would have been in the ideal case. The user currently sees placeholder
|
// than it would have been in the ideal case. The user currently sees placeholder
|
||||||
// cards instead of real cards for approximately this length of time. This is
|
// cards instead of real cards for approximately this length of time. This is
|
||||||
|
|
|
@ -186,6 +186,9 @@ export const SessionPing = Joi.object().keys(Object.assign({}, baseKeys, {
|
||||||
// The count of pinned Top Sites.
|
// The count of pinned Top Sites.
|
||||||
topsites_pinned: Joi.number(),
|
topsites_pinned: Joi.number(),
|
||||||
|
|
||||||
|
// The count of search shortcut Top Sites.
|
||||||
|
topsites_search_shortcuts: Joi.number(),
|
||||||
|
|
||||||
// When the page itself receives an event that document.visibilityState
|
// When the page itself receives an event that document.visibilityState
|
||||||
// == visible.
|
// == visible.
|
||||||
//
|
//
|
||||||
|
|
|
@ -107,7 +107,8 @@ describe("<TopSites>", () => {
|
||||||
"rich_icon": 0,
|
"rich_icon": 0,
|
||||||
"no_image": 0
|
"no_image": 0
|
||||||
},
|
},
|
||||||
topsites_pinned: 0
|
topsites_pinned: 0,
|
||||||
|
topsites_search_shortcuts: 0
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
@ -128,7 +129,8 @@ describe("<TopSites>", () => {
|
||||||
"rich_icon": 0,
|
"rich_icon": 0,
|
||||||
"no_image": 0
|
"no_image": 0
|
||||||
},
|
},
|
||||||
topsites_pinned: 0
|
topsites_pinned: 0,
|
||||||
|
topsites_search_shortcuts: 0
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
@ -149,7 +151,8 @@ describe("<TopSites>", () => {
|
||||||
"rich_icon": 0,
|
"rich_icon": 0,
|
||||||
"no_image": 0
|
"no_image": 0
|
||||||
},
|
},
|
||||||
topsites_pinned: 0
|
topsites_pinned: 0,
|
||||||
|
topsites_search_shortcuts: 0
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
@ -170,7 +173,8 @@ describe("<TopSites>", () => {
|
||||||
"rich_icon": 0,
|
"rich_icon": 0,
|
||||||
"no_image": 0
|
"no_image": 0
|
||||||
},
|
},
|
||||||
topsites_pinned: 0
|
topsites_pinned: 0,
|
||||||
|
topsites_search_shortcuts: 0
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
@ -191,7 +195,8 @@ describe("<TopSites>", () => {
|
||||||
"rich_icon": 1,
|
"rich_icon": 1,
|
||||||
"no_image": 0
|
"no_image": 0
|
||||||
},
|
},
|
||||||
topsites_pinned: 0
|
topsites_pinned: 0,
|
||||||
|
topsites_search_shortcuts: 0
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
@ -212,7 +217,8 @@ describe("<TopSites>", () => {
|
||||||
"rich_icon": 0,
|
"rich_icon": 0,
|
||||||
"no_image": 1
|
"no_image": 1
|
||||||
},
|
},
|
||||||
topsites_pinned: 0
|
topsites_pinned: 0,
|
||||||
|
topsites_search_shortcuts: 0
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
@ -233,7 +239,8 @@ describe("<TopSites>", () => {
|
||||||
"rich_icon": 0,
|
"rich_icon": 0,
|
||||||
"no_image": 1
|
"no_image": 1
|
||||||
},
|
},
|
||||||
topsites_pinned: 0
|
topsites_pinned: 0,
|
||||||
|
topsites_search_shortcuts: 0
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
@ -254,7 +261,30 @@ describe("<TopSites>", () => {
|
||||||
"rich_icon": 0,
|
"rich_icon": 0,
|
||||||
"no_image": 3
|
"no_image": 3
|
||||||
},
|
},
|
||||||
topsites_pinned: 2
|
topsites_pinned: 2,
|
||||||
|
topsites_search_shortcuts: 0
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
it("should correctly count search shortcut Top Sites", () => {
|
||||||
|
const rows = [{searchTopSite: true}, {searchTopSite: true}];
|
||||||
|
sandbox.stub(DEFAULT_PROPS.TopSites, "rows").value(rows);
|
||||||
|
wrapper.instance()._dispatchTopSitesStats();
|
||||||
|
|
||||||
|
assert.calledOnce(DEFAULT_PROPS.dispatch);
|
||||||
|
assert.calledWithExactly(DEFAULT_PROPS.dispatch, ac.AlsoToMain({
|
||||||
|
type: at.SAVE_SESSION_PERF_DATA,
|
||||||
|
data: {
|
||||||
|
topsites_icon_stats: {
|
||||||
|
"custom_screenshot": 0,
|
||||||
|
"screenshot_with_icon": 0,
|
||||||
|
"screenshot": 0,
|
||||||
|
"tippytop": 0,
|
||||||
|
"rich_icon": 0,
|
||||||
|
"no_image": 2
|
||||||
|
},
|
||||||
|
topsites_pinned: 0,
|
||||||
|
topsites_search_shortcuts: 2
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
@ -276,7 +306,8 @@ describe("<TopSites>", () => {
|
||||||
"rich_icon": 0,
|
"rich_icon": 0,
|
||||||
"no_image": 8
|
"no_image": 8
|
||||||
},
|
},
|
||||||
topsites_pinned: 0
|
topsites_pinned: 0,
|
||||||
|
topsites_search_shortcuts: 0
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
@ -297,7 +328,8 @@ describe("<TopSites>", () => {
|
||||||
"rich_icon": 0,
|
"rich_icon": 0,
|
||||||
"no_image": 6
|
"no_image": 6
|
||||||
},
|
},
|
||||||
topsites_pinned: 0
|
topsites_pinned: 0,
|
||||||
|
topsites_search_shortcuts: 0
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
|
@ -200,7 +200,8 @@ describe("TelemetryFeed", () => {
|
||||||
"rich_icon": 1,
|
"rich_icon": 1,
|
||||||
"no_image": 0
|
"no_image": 0
|
||||||
},
|
},
|
||||||
topsites_pinned: 3
|
topsites_pinned: 3,
|
||||||
|
topsites_search_shortcuts: 2
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create a ping referencing the session
|
// Create a ping referencing the session
|
||||||
|
@ -209,6 +210,7 @@ describe("TelemetryFeed", () => {
|
||||||
assert.propertyVal(instance.sessions.get("foo").perf.topsites_icon_stats,
|
assert.propertyVal(instance.sessions.get("foo").perf.topsites_icon_stats,
|
||||||
"screenshot_with_icon", 2);
|
"screenshot_with_icon", 2);
|
||||||
assert.equal(instance.sessions.get("foo").perf.topsites_pinned, 3);
|
assert.equal(instance.sessions.get("foo").perf.topsites_pinned, 3);
|
||||||
|
assert.equal(instance.sessions.get("foo").perf.topsites_search_shortcuts, 2);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче