fix #117: add all remaining events' telemetry
open-tab, hide-tabs, show-tabs, move-tabs-to-window add-container, edit-container, delete-container
This commit is contained in:
parent
d01d89ed60
commit
2bae0253a6
2 changed files with 64 additions and 13 deletions
|
@ -114,7 +114,6 @@ of a `testpilottest` telemetry ping for each scenario.
|
||||||
```js
|
```js
|
||||||
{
|
{
|
||||||
"uuid": <uuid>,
|
"uuid": <uuid>,
|
||||||
"userContextId": <userContextId>,
|
|
||||||
"event": "add-container"
|
"event": "add-container"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
64
index.js
64
index.js
|
@ -204,16 +204,24 @@ const ContainerService = {
|
||||||
return totalNonContainerTabsCount;
|
return totalNonContainerTabsCount;
|
||||||
},
|
},
|
||||||
|
|
||||||
_shownContainersCount() {
|
_containersCounts() {
|
||||||
// Returns the number of containers with at least 1 tab open
|
let containersCounts = { // eslint-disable-line prefer-const
|
||||||
let shownContainersCount = 0;
|
"shown": 0,
|
||||||
|
"hidden": 0,
|
||||||
|
"total": 0
|
||||||
|
};
|
||||||
for (const userContextId in this._identitiesState) {
|
for (const userContextId in this._identitiesState) {
|
||||||
if (this._identitiesState[userContextId].openTabs > 0) {
|
if (this._identitiesState[userContextId].openTabs > 0) {
|
||||||
++shownContainersCount;
|
++containersCounts.shown;
|
||||||
|
++containersCounts.total;
|
||||||
|
continue;
|
||||||
|
} else if (this._identitiesState[userContextId].hiddenTabs.length > 0) {
|
||||||
|
++containersCounts.hidden;
|
||||||
|
++containersCounts.total;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return shownContainersCount;
|
return containersCounts;
|
||||||
},
|
},
|
||||||
|
|
||||||
_convert(identity) {
|
_convert(identity) {
|
||||||
|
@ -367,6 +375,16 @@ const ContainerService = {
|
||||||
return Promise.resolve(null);
|
return Promise.resolve(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const containersCounts = this._containersCounts();
|
||||||
|
this.sendTelemetryPayload({
|
||||||
|
"event": "hide-tabs",
|
||||||
|
"userContextId": args.userContextId,
|
||||||
|
"clickedContainerTabCount": this._containerTabCount(args.userContextId),
|
||||||
|
"shownContainersCount": containersCounts.shown,
|
||||||
|
"hiddenContainersCount": containersCounts.hidden,
|
||||||
|
"totalContainersCount": containersCounts.total
|
||||||
|
});
|
||||||
|
|
||||||
const tabsToClose = [];
|
const tabsToClose = [];
|
||||||
|
|
||||||
this._containerTabIterator(args.userContextId, tab => {
|
this._containerTabIterator(args.userContextId, tab => {
|
||||||
|
@ -401,6 +419,16 @@ const ContainerService = {
|
||||||
return Promise.resolve(null);
|
return Promise.resolve(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const containersCounts = this._containersCounts();
|
||||||
|
this.sendTelemetryPayload({
|
||||||
|
"event": "show-tabs",
|
||||||
|
"userContextId": args.userContextId,
|
||||||
|
"clickedContainerTabCount": this._containerTabCount(args.userContextId),
|
||||||
|
"shownContainersCount": containersCounts.shown,
|
||||||
|
"hiddenContainersCount": containersCounts.hidden,
|
||||||
|
"totalContainersCount": containersCounts.total
|
||||||
|
});
|
||||||
|
|
||||||
const promises = [];
|
const promises = [];
|
||||||
|
|
||||||
for (let object of this._identitiesState[args.userContextId].hiddenTabs) { // eslint-disable-line prefer-const
|
for (let object of this._identitiesState[args.userContextId].hiddenTabs) { // eslint-disable-line prefer-const
|
||||||
|
@ -415,9 +443,10 @@ const ContainerService = {
|
||||||
},
|
},
|
||||||
|
|
||||||
sortTabs() {
|
sortTabs() {
|
||||||
|
const containersCounts = this._containersCounts();
|
||||||
this.sendTelemetryPayload({
|
this.sendTelemetryPayload({
|
||||||
"event": "sort-tabs",
|
"event": "sort-tabs",
|
||||||
"shownContainersCount": this._shownContainersCount(),
|
"shownContainersCount": containersCounts.shown,
|
||||||
"totalContainerTabsCount": this._totalContainerTabsCount(),
|
"totalContainerTabsCount": this._totalContainerTabsCount(),
|
||||||
"totalNonContainerTabsCount": this._totalNonContainerTabsCount()
|
"totalNonContainerTabsCount": this._totalNonContainerTabsCount()
|
||||||
});
|
});
|
||||||
|
@ -530,6 +559,12 @@ const ContainerService = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.sendTelemetryPayload({
|
||||||
|
"event": "move-tabs-to-window",
|
||||||
|
"userContextId": args.userContextId,
|
||||||
|
"clickedContainerTabCount": this._containerTabCount(args.userContextId),
|
||||||
|
});
|
||||||
|
|
||||||
// Let's create a list of the tabs.
|
// Let's create a list of the tabs.
|
||||||
const list = [];
|
const list = [];
|
||||||
this._containerTabIterator(args.userContextId, tab => {
|
this._containerTabIterator(args.userContextId, tab => {
|
||||||
|
@ -573,12 +608,15 @@ const ContainerService = {
|
||||||
const userContextId = ("userContextId" in args) ? args.userContextId : 0;
|
const userContextId = ("userContextId" in args) ? args.userContextId : 0;
|
||||||
const source = ("source" in args) ? args.source : null;
|
const source = ("source" in args) ? args.source : null;
|
||||||
|
|
||||||
|
// Only send telemetry for tabs opened by UI - i.e., not via showTabs
|
||||||
|
if (source) {
|
||||||
this.sendTelemetryPayload({
|
this.sendTelemetryPayload({
|
||||||
"event": "open-tab",
|
"event": "open-tab",
|
||||||
"eventSource": source,
|
"eventSource": source,
|
||||||
"userContextId": userContextId,
|
"userContextId": userContextId,
|
||||||
"clickedContainerTabCount": this._containerTabCount(userContextId)
|
"clickedContainerTabCount": this._containerTabCount(userContextId)
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const tab = browserWin.gBrowser.addTab(args.url || null, { userContextId });
|
const tab = browserWin.gBrowser.addTab(args.url || null, { userContextId });
|
||||||
browserWin.gBrowser.selectedTab = tab;
|
browserWin.gBrowser.selectedTab = tab;
|
||||||
|
@ -613,6 +651,10 @@ const ContainerService = {
|
||||||
},
|
},
|
||||||
|
|
||||||
createIdentity(args) {
|
createIdentity(args) {
|
||||||
|
this.sendTelemetryPayload({
|
||||||
|
"event": "add-container",
|
||||||
|
});
|
||||||
|
|
||||||
for (let arg of [ "name", "color", "icon"]) { // eslint-disable-line prefer-const
|
for (let arg of [ "name", "color", "icon"]) { // eslint-disable-line prefer-const
|
||||||
if (!(arg in args)) {
|
if (!(arg in args)) {
|
||||||
return Promise.reject("createIdentity must be called with " + arg + " argument.");
|
return Promise.reject("createIdentity must be called with " + arg + " argument.");
|
||||||
|
@ -638,6 +680,11 @@ const ContainerService = {
|
||||||
return Promise.reject("updateIdentity must be called with userContextId argument.");
|
return Promise.reject("updateIdentity must be called with userContextId argument.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.sendTelemetryPayload({
|
||||||
|
"event": "edit-container",
|
||||||
|
"userContextId": args.userContextId
|
||||||
|
});
|
||||||
|
|
||||||
const identity = ContextualIdentityService.getIdentityFromId(args.userContextId);
|
const identity = ContextualIdentityService.getIdentityFromId(args.userContextId);
|
||||||
for (let arg of [ "name", "color", "icon"]) { // eslint-disable-line prefer-const
|
for (let arg of [ "name", "color", "icon"]) { // eslint-disable-line prefer-const
|
||||||
if ((arg in args)) {
|
if ((arg in args)) {
|
||||||
|
@ -664,6 +711,11 @@ const ContainerService = {
|
||||||
return Promise.reject("removeIdentity must be called with userContextId argument.");
|
return Promise.reject("removeIdentity must be called with userContextId argument.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.sendTelemetryPayload({
|
||||||
|
"event": "delete-container",
|
||||||
|
"userContextId": args.userContextId
|
||||||
|
});
|
||||||
|
|
||||||
const tabsToClose = [];
|
const tabsToClose = [];
|
||||||
this._containerTabIterator(args.userContextId, tab => {
|
this._containerTabIterator(args.userContextId, tab => {
|
||||||
tabsToClose.push(tab);
|
tabsToClose.push(tab);
|
||||||
|
|
Loading…
Add table
Reference in a new issue