Skip to content

Commit 48395d2

Browse files
committed
Merge branch 'release-v0.26.0' into release
2 parents c50d321 + b4a55d7 commit 48395d2

File tree

21 files changed

+369
-314
lines changed

21 files changed

+369
-314
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ jobs:
156156
pip install -r requirements.txt
157157
glean_parser translate src/App/metrics.yaml src/App/pings.yaml \
158158
-f javascript -o src/App/generated \
159-
--option platform=qt --option version="0.25"
159+
--option platform=qt --option version="0.26"
160160
- run:
161161
name: Run Qt sample tests
162162
command: |

CHANGELOG.md

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

3-
[Full changelog](https://github.com/mozilla/glean.js/compare/v0.25.0...main)
3+
[Full changelog](https://github.com/mozilla/glean.js/compare/v0.26.0...main)
4+
5+
# v0.26.0 (2021-11-19)
6+
7+
[Full changelog](https://github.com/mozilla/glean.js/compare/v0.25.0...v0.26.0)
8+
9+
* [#965](https://github.com/mozilla/glean.js/pull/965): Attempt to infer the Python virtualenv folder from the environment before falling back to the default `.venv`.
10+
* Users may provide a folder name through the `VIRTUAL_ENV` environment variable.
11+
* If the user is inside an active virtualenv the `VIRTUAL_ENV` environment variable is already set by Python. See: https://docs.python.org/3/library/venv.html.
12+
* [#968](https://github.com/mozilla/glean.js/pull/968): Add runtime arguments type checking to `Glean.setUploadEnabled` API.
13+
* [#970](https://github.com/mozilla/glean.js/pull/970): BUGFIX: Guarantee uploading is immediatelly resumed if the uploader has been stopped due to any of the uploading limits being hit.
414

515
# v0.25.0 (2021-11-15)
616

glean/package-lock.json

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

glean/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mozilla/glean",
3-
"version": "0.25.0",
3+
"version": "0.26.0",
44
"description": "An implementation of the Glean SDK, a modern cross-platform telemetry client, for JavaScript environments.",
55
"type": "module",
66
"sideEffects": "false",

glean/src/cli.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,16 @@ import log, { LoggingLevel } from "./core/log.js";
1414

1515
const LOG_TAG = "CLI";
1616

17-
// The name of the directory which will contain the Python virtual environment
17+
// The name of the directory which contains / will contain the Python virtual environment
1818
// used to run the glean-parser.
19-
const VIRTUAL_ENVIRONMENT_DIR = ".venv";
19+
//
20+
// > When a virtual environment is active, the VIRTUAL_ENV environment variable
21+
// > is set to the path of the virtual environment. This can be used to check if
22+
// > one is running inside a virtual environment.
23+
//
24+
// See: https://docs.python.org/3/library/venv.html
25+
// (Also applies to envs created using virtualenv though)
26+
const VIRTUAL_ENVIRONMENT_DIR = process.env.VIRTUAL_ENV?.split("/").slice(-1)[0] || ".venv";
2027

2128
// The version of glean_parser to install from PyPI.
2229
const GLEAN_PARSER_VERSION = "4.1.1";

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 = "0.25.0";
11+
export const GLEAN_VERSION = "0.26.0";
1212

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

glean/src/core/glean.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,15 @@ class Glean {
356356
* @param flag When true, enable metric collection.
357357
*/
358358
static setUploadEnabled(flag: boolean): void {
359+
if (!isBoolean(flag)) {
360+
log(
361+
LOG_TAG,
362+
"Unable to change upload state, new value must be a boolean. Ignoring.",
363+
LoggingLevel.Error
364+
);
365+
return;
366+
}
367+
359368
Context.dispatcher.launch(async () => {
360369
if (!Context.initialized) {
361370
log(

glean/src/core/upload/index.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ class PingUploader implements PingsDatabaseObserver {
9393
private readonly platformInfo: PlatformInfo;
9494
// The server address we are sending pings to.
9595
private readonly serverEndpoint: string;
96+
// Whether or not uploading is currently stopped due to limits having been hit.
97+
private stopped = false;
9698

9799
constructor(
98100
config: Configuration,
@@ -132,17 +134,21 @@ class PingUploader implements PingsDatabaseObserver {
132134
const { state: rateLimiterState, remainingTime } = this.rateLimiter.getState();
133135
if (rateLimiterState === RateLimiterState.Incrementing) {
134136
this.dispatcher.resume();
137+
this.stopped = false;
135138
} else {
136-
// Stop the dispatcher respecting the order of the dispatcher queue,
137-
// to make sure the Stop command is enqueued _after_ previously enqueued requests.
138-
this.dispatcher.stop(false);
139+
if(!this.stopped) {
140+
// Stop the dispatcher respecting the order of the dispatcher queue,
141+
// to make sure the Stop command is enqueued _after_ previously enqueued requests.
142+
this.dispatcher.stop(false);
143+
this.stopped = true;
144+
}
139145

140146
if (rateLimiterState === RateLimiterState.Throttled) {
141147
log(
142148
LOG_TAG,
143149
[
144-
"Attempted to upload a ping, but Glean is currently throttled.",
145-
`Pending pings will be processed in ${(remainingTime || 0) / 1000}s.`
150+
"Succesfully submitted a ping, but Glean is currently throttled.",
151+
`Pending pings may be uploaded in ${(remainingTime || 0) / 1000}s.`
146152
],
147153
LoggingLevel.Debug
148154
);
@@ -151,9 +157,9 @@ class PingUploader implements PingsDatabaseObserver {
151157
log(
152158
LOG_TAG,
153159
[
154-
"Attempted to upload a ping, but Glean has reached maximum recoverable upload failures",
155-
"for the current uploading window.",
156-
`Will retry in ${(remainingTime || 0) / 1000}s.`
160+
"Succesfully submitted a ping,",
161+
"but Glean has reached maximum recoverable upload failures for the current uploading window.",
162+
`May retry in ${(remainingTime || 0) / 1000}s.`
157163
],
158164
LoggingLevel.Debug
159165
);

glean/src/metrics.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
# License, v. 2.0. If a copy of the MPL was not distributed with this
33
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
44

5-
# This file defines the metrics that are recorded by the Glean SDK.
6-
# APIs to use these pings are automatically generated at build time using
7-
# the `glean_parser` PyPI package.
5+
# This file defines the metrics that are recorded by the Glean JavaScript SDK.
86

97
# Metrics in this file may make use of SDK reserved ping names. See
108
# https://mozilla.github.io/glean/book/dev/core/internal/reserved-ping-names.html

glean/src/pings.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
# License, v. 2.0. If a copy of the MPL was not distributed with this
33
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
44

5-
# This file defines the pings that are recorded by the Glean SDK.
6-
# Their code APIs is automatically generated, at build time using,
7-
# the `glean_parser` PyPI package.
5+
# This file defines the pings that are recorded by the Glean JavaScript SDK.
86

97
---
108
$schema: moz://mozilla.org/schemas/glean/pings/2-0-0

0 commit comments

Comments
 (0)