Skip to content

Commit 752e716

Browse files
committed
Bug 1857324 - Remove old pocket_button ping r=thecount
Depends on D191341 Differential Revision: https://phabricator.services.mozilla.com/D191238
1 parent a469302 commit 752e716

File tree

3 files changed

+0
-159
lines changed

3 files changed

+0
-159
lines changed

browser/components/pocket/content/pktTelemetry.sys.mjs

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,13 @@
44

55
const lazy = {};
66
ChromeUtils.defineESModuleGetters(lazy, {
7-
PingCentre: "resource:///modules/PingCentre.sys.mjs",
87
TelemetryEnvironment: "resource://gre/modules/TelemetryEnvironment.sys.mjs",
98
pktApi: "chrome://pocket/content/pktApi.sys.mjs",
109
});
1110

12-
// List of namespaces for the structured ingestion system.
13-
// They are defined in https://github.com/mozilla-services/mozilla-pipeline-schemas
14-
const STRUCTURED_INGESTION_NAMESPACE_AS = "activity-stream";
15-
const STRUCTURED_INGESTION_ENDPOINT_PREF =
16-
"browser.newtabpage.activity-stream.telemetry.structuredIngestion.endpoint";
17-
// This is the topic for telemetry pings, used inside PingCentre.
18-
const POCKET_TELEMETRY_TOPIC = "pocket";
1911
const PREF_IMPRESSION_ID = "browser.newtabpage.activity-stream.impressionId";
2012

21-
ChromeUtils.defineLazyGetter(lazy, "pingCentre", () => {
22-
return new lazy.PingCentre({ topic: POCKET_TELEMETRY_TOPIC });
23-
});
24-
2513
export var pktTelemetry = {
26-
get structuredIngestionEndpointBase() {
27-
if (!this._structuredIngestionEndpointBase) {
28-
this._structuredIngestionEndpointBase = Services.prefs.getStringPref(
29-
STRUCTURED_INGESTION_ENDPOINT_PREF,
30-
""
31-
);
32-
}
33-
return this._structuredIngestionEndpointBase;
34-
},
35-
3614
get impressionId() {
3715
if (!this._impressionId) {
3816
this._impressionId = this.getOrCreateImpressionId();
@@ -53,62 +31,13 @@ export var pktTelemetry = {
5331
return impressionId;
5432
},
5533

56-
/**
57-
* createPingPayload - Create a ping for an impression stats
58-
*
59-
* @param {ob} data The data object to be included in the ping.
60-
* @return {obj} A telemetry ping
61-
*/
62-
createPingPayload(data) {
63-
// experiments, locale, version, and release_channel are provided by pingCentre.
64-
// model and events is provided in the data param.
65-
return {
66-
...data,
67-
impression_id: this.impressionId,
68-
pocket_logged_in_status: lazy.pktApi.isUserLoggedIn(),
69-
profile_creation_date: this._profileCreationDate(),
70-
};
71-
},
72-
7334
_profileCreationDate() {
7435
return (
7536
lazy.TelemetryEnvironment.currentEnvironment.profile.resetDate ||
7637
lazy.TelemetryEnvironment.currentEnvironment.profile.creationDate
7738
);
7839
},
7940

80-
_generateUUID() {
81-
return String(Services.uuid.generateUUID());
82-
},
83-
84-
/**
85-
* Generates an endpoint for Structured Ingestion telemetry pipeline. Note that
86-
* Structured Ingestion requires a different endpoint for each ping. See more
87-
* details about endpoint schema at:
88-
* https://github.com/mozilla/gcp-ingestion/blob/master/docs/edge.md#postput-request
89-
*/
90-
_generateStructuredIngestionEndpoint() {
91-
const uuid = this._generateUUID();
92-
// Structured Ingestion does not support the UUID generated by gUUIDGenerator,
93-
// because it contains leading and trailing braces. Need to trim them first.
94-
const docID = uuid.slice(1, -1);
95-
const extension = `${STRUCTURED_INGESTION_NAMESPACE_AS}/pocket-button/1/${docID}`;
96-
return `${this.structuredIngestionEndpointBase}/${extension}`;
97-
},
98-
99-
/**
100-
* sendStructuredIngestionEvent - Sent a ping for an impression stats
101-
*
102-
* @param {ob} eventObject The data object to be included in the ping.
103-
*/
104-
sendStructuredIngestionEvent(eventObject) {
105-
lazy.pingCentre.sendStructuredIngestionPing(
106-
eventObject,
107-
this._generateStructuredIngestionEndpoint(),
108-
STRUCTURED_INGESTION_NAMESPACE_AS
109-
);
110-
},
111-
11241
/**
11342
* Records the provided data and common pocket-button data to Glean,
11443
* then submits it all in a pocket-button ping.

browser/components/pocket/content/pktUI.js

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -227,32 +227,10 @@ var pktUI = (function () {
227227
// Ensure opening the signup panel clears the icon state from any previous sessions.
228228
SaveToPocket.itemDeleted();
229229
pktTelemetry.submitPocketButtonPing("click", "save_button");
230-
// A successful button click, for logged out users.
231-
pktTelemetry.sendStructuredIngestionEvent(
232-
pktTelemetry.createPingPayload({
233-
events: [
234-
{
235-
action: "click",
236-
source: "save_button",
237-
},
238-
],
239-
})
240-
);
241230
}
242231

243232
async function onShowHome() {
244233
pktTelemetry.submitPocketButtonPing("click", "home_button");
245-
// A successful home button click.
246-
pktTelemetry.sendStructuredIngestionEvent(
247-
pktTelemetry.createPingPayload({
248-
events: [
249-
{
250-
action: "click",
251-
source: "home_button",
252-
},
253-
],
254-
})
255-
);
256234

257235
if (!NimbusFeatures.saveToPocket.getVariable("hideRecentSaves")) {
258236
let recentSaves = await pktApi.getRecentSavesCache();
@@ -303,17 +281,6 @@ var pktUI = (function () {
303281
}
304282

305283
pktTelemetry.submitPocketButtonPing("click", "save_button");
306-
// A successful button click, for logged in users.
307-
pktTelemetry.sendStructuredIngestionEvent(
308-
pktTelemetry.createPingPayload({
309-
events: [
310-
{
311-
action: "click",
312-
source: "save_button",
313-
},
314-
],
315-
})
316-
);
317284

318285
// Add url
319286
var options = {
@@ -455,19 +422,6 @@ var pktUI = (function () {
455422
if (data.source) {
456423
const { position, source, model } = data;
457424
pktTelemetry.submitPocketButtonPing("click", source, position, model);
458-
const payload = pktTelemetry.createPingPayload({
459-
...(model ? { model } : {}),
460-
events: [
461-
{
462-
action: "click",
463-
source,
464-
// Add in position if needed, for example, topic links have a position.
465-
...(position || position === 0 ? { position } : {}),
466-
},
467-
],
468-
});
469-
// Send click event ping.
470-
pktTelemetry.sendStructuredIngestionEvent(payload);
471425
}
472426

473427
var url = data.url;
@@ -495,18 +449,6 @@ var pktUI = (function () {
495449
position,
496450
model
497451
);
498-
const payload = pktTelemetry.createPingPayload({
499-
model,
500-
events: [
501-
{
502-
action: "click",
503-
position,
504-
source: "on_save_recs",
505-
},
506-
],
507-
});
508-
// Send click event ping.
509-
pktTelemetry.sendStructuredIngestionEvent(payload);
510452
}
511453

512454
openTabWithUrl(url, contentPrincipal, csp);

browser/components/pocket/test/unit/browser_pocket_pktTelemetry.js

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -23,36 +23,6 @@ function test_runner(test) {
2323
add_task(testTask);
2424
}
2525

26-
test_runner(async function test_createPingPayload({ sandbox }) {
27-
const impressionId = "{7fd5a1ac-6089-4212-91a7-fcdec1d2f533}";
28-
const creationDate = "18578";
29-
await SpecialPowers.pushPrefEnv({
30-
set: [["browser.newtabpage.activity-stream.impressionId", impressionId]],
31-
});
32-
sandbox.stub(pktTelemetry, "_profileCreationDate").returns(creationDate);
33-
const result = pktTelemetry.createPingPayload({ test: "test" });
34-
35-
Assert.deepEqual(result, {
36-
test: "test",
37-
pocket_logged_in_status: false,
38-
profile_creation_date: creationDate,
39-
impression_id: impressionId,
40-
});
41-
});
42-
43-
test_runner(async function test_generateStructuredIngestionEndpoint({
44-
sandbox,
45-
}) {
46-
sandbox
47-
.stub(pktTelemetry, "_generateUUID")
48-
.returns("{7fd5a1ac-6089-4212-91a7-fcdec1d2f533}");
49-
const endpoint = pktTelemetry._generateStructuredIngestionEndpoint();
50-
Assert.equal(
51-
endpoint,
52-
"https://incoming.telemetry.mozilla.org/submit/activity-stream/pocket-button/1/7fd5a1ac-6089-4212-91a7-fcdec1d2f533"
53-
);
54-
});
55-
5626
test_runner(async function test_submitPocketButtonPing({ sandbox }) {
5727
const creationDate = "19640";
5828
const impressionId = "{422e3da9-c694-4fd2-b676-8ae070156128}";

0 commit comments

Comments
 (0)