Skip to content

Commit 9638c47

Browse files
committed
Merge branch 'release-v4.0.0-pre.2' into release
2 parents 245c9ae + f414711 commit 9638c47

File tree

13 files changed

+205
-41
lines changed

13 files changed

+205
-41
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ jobs:
108108
- checkout
109109
- install-node
110110
- run:
111-
name: Run browser comapt smoke tests
111+
name: Run browser compat smoke tests
112112
command: |
113113
npm --prefix ./automation install
114114
npm --prefix ./automation run link:glean

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Unreleased changes
22

3-
[Full changelog](https://github.com/mozilla/glean.js/compare/v4.0.0-pre.1...main)
3+
[Full changelog](https://github.com/mozilla/glean.js/compare/v4.0.0-pre.2...main)
4+
5+
# v4.0.0-pre.2 (2023-12-06)
6+
7+
[Full changelog](https://github.com/mozilla/glean.js/compare/v4.0.0-pre.1...v4.0.0-pre.2)
8+
9+
[#1835](https://github.com/mozilla/glean.js/pull/1835): Added support for automatic page load instrumentation.
410

511
# v4.0.0-pre.1 (2023-12-01)
612

@@ -14,6 +20,8 @@
1420

1521
[#1808](https://github.com/mozilla/glean.js/pull/1808): **BREAKING CHANGE**: Make glean.js fully synchronous.
1622

23+
* [#1835](https://github.com/mozilla/glean.js/pull/1835): Automatic instrumentation of page load events for simple web properties.
24+
1725
# v3.0.0 (2023-11-16)
1826

1927
[Full changelog](https://github.com/mozilla/glean.js/compare/v3.0.0-pre.1...v3.0.0)

automation/compat/index.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ import { benchmark } from "./generated/pings.js";
99
import * as metrics from "./generated/sample.js";
1010

1111
Glean.setSourceTags(["automation"]);
12-
Glean.initialize("glean-compat-benchmark", true);
12+
Glean.initialize("glean-compat-benchmark", true, {
13+
enableAutoPageLoadEvents: true
14+
});
1315

1416
metrics.pageLoaded.set();
1517
benchmark.submit();
@@ -18,6 +20,7 @@ benchmark.submit();
1820
//
1921
// Overwrite the console.info function in order to know when (and if) the benchmark ping was sent.
2022
// If a success ping message is logged we show that in the document.
23+
let pingSubmissionCount = 0;
2124
console.info = function () {
2225
var message = "";
2326
for (var i = 0; i < arguments.length; i++) {
@@ -29,7 +32,14 @@ console.info = function () {
2932
}
3033
console.log(message);
3134
if (/successfully sent 200.$/.test(message)) {
32-
var elem = document.getElementById("msg");
33-
elem.innerHTML = "Ping submitted successfully.";
35+
pingSubmissionCount++;
36+
37+
// Two pings should be submitted when run successfully
38+
// 1. The built-in page_load event, which submits an events ping.
39+
// 2. The benchmark ping.
40+
if (pingSubmissionCount == 2) {
41+
var elem = document.getElementById("msg");
42+
elem.innerHTML = "Pings submitted successfully.";
43+
}
3444
}
3545
}

automation/compat/tests/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export async function runWebTest(driver) {
101101
await driver.wait(
102102
until.elementTextIs(
103103
successTextContainer,
104-
"Ping submitted successfully."
104+
"Pings submitted successfully."
105105
), 11_000); // 1s more than the default upload timeout in Glean.
106106

107107
console.log("Test passed.");

automation/package-lock.json

Lines changed: 7 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

automation/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"author": "The Glean Team <glean-team@mozilla.com>",
2121
"license": "MPL-2.0",
2222
"devDependencies": {
23-
"@octokit/request": "^8.1.5",
23+
"@octokit/request": "^8.1.6",
2424
"browserstack-local": "^1.5.5",
2525
"geckodriver": "^4.2.1",
2626
"patch-package": "^8.0.0",

glean/package-lock.json

Lines changed: 41 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

glean/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mozilla/glean",
3-
"version": "4.0.0-pre.1",
3+
"version": "4.0.0-pre.2",
44
"description": "An implementation of the Glean SDK, a modern cross-platform telemetry client, for JavaScript environments.",
55
"type": "module",
66
"sideEffects": false,
@@ -11,7 +11,8 @@
1111
"./private/ping": "./dist/core/pings/ping_type.js",
1212
"./uploader": "./dist/core/upload/uploader.js",
1313
"./testing": "./dist/core/testing/index.js",
14-
"./web": "./dist/entry/web.js"
14+
"./web": "./dist/entry/web.js",
15+
"./metrics": "./dist/core/glean_metrics.js"
1516
},
1617
"typesVersions": {
1718
"*": {
@@ -32,6 +33,9 @@
3233
],
3334
"error": [
3435
"./dist/types/core/error/error_type.d.ts"
36+
],
37+
"metrics": [
38+
"./dist/types/core/glean_metrics.d.ts"
3539
]
3640
}
3741
},

glean/src/core/config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ export interface ConfigurationInterface {
4747
// Migrate from legacy storage (IndexedDB) to the new one (LocalStorage).
4848
// This should only be true for older projects that have existing data in IndexedDB.
4949
readonly migrateFromLegacyStorage?: boolean,
50+
// Allow the client to explicitly specify whether they want page load events to be
51+
// collected automatically.
52+
readonly enableAutoPageLoadEvents?: boolean,
5053
}
5154

5255
// Important: the `Configuration` should only be used internally by the Glean singleton.
@@ -58,6 +61,7 @@ export class Configuration implements ConfigurationInterface {
5861
readonly buildDate?: Date;
5962
readonly maxEvents: number;
6063
readonly migrateFromLegacyStorage?: boolean;
64+
readonly enableAutoPageLoadEvents?: boolean;
6165

6266
// Debug configuration.
6367
debug: DebugOptions;
@@ -71,6 +75,7 @@ export class Configuration implements ConfigurationInterface {
7175
this.buildDate = config?.buildDate;
7276
this.maxEvents = config?.maxEvents || DEFAULT_MAX_EVENTS;
7377
this.migrateFromLegacyStorage = config?.migrateFromLegacyStorage;
78+
this.enableAutoPageLoadEvents = config?.enableAutoPageLoadEvents;
7479

7580
this.debug = {};
7681

glean/src/core/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const GLEAN_SCHEMA_VERSION = 1;
88
//
99
// PACKAGE_VERSION is defined as a global by webpack,
1010
// we need a default here for testing when the app is not build with webpack.
11-
export const GLEAN_VERSION = "4.0.0-pre.1";
11+
export const GLEAN_VERSION = "4.0.0-pre.2";
1212

1313
// The name of a "ping" that will include Glean ping_info metrics,
1414
// such as ping sequence numbers.

0 commit comments

Comments
 (0)