Skip to content

Commit 9b944da

Browse files
committed
Merge branch 'release-v0.14.1' into release
2 parents 68521f5 + 7e54719 commit 9b944da

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1156
-276
lines changed

.circleci/config.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ jobs:
3535
name: Run circular dependencies checker
3636
command: npm --prefix ./glean run lint:circular-deps
3737

38-
unit-tests:
38+
test:
3939
docker:
40-
- image: cimg/node:16.1.0
40+
- image: cimg/python:3.9.4-node
4141
steps:
4242
- checkout
4343
- run:
@@ -51,7 +51,10 @@ jobs:
5151
command: npm --prefix ./glean install
5252
- run:
5353
name: Run unit tests
54-
command: export PATH=.:$PATH && npm --prefix ./glean run test
54+
command: export PATH=.:$PATH && npm --prefix ./glean run test:unit
55+
- run:
56+
name: Run integration tests
57+
command: export PATH=.:$PATH && npm --prefix ./glean run test:integration
5558

5659
samples-tests:
5760
docker:
@@ -196,7 +199,7 @@ workflows:
196199
ci:
197200
jobs:
198201
- lint
199-
- unit-tests
202+
- test
200203
- check-qt-js
201204
- samples-tests
202205
- docs-deploy:

CHANGELOG.md

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

3-
[Full changelog](https://github.com/mozilla/glean.js/compare/v0.14.0...main)
3+
[Full changelog](https://github.com/mozilla/glean.js/compare/v0.14.1...main)
4+
5+
# v0.14.1 (2021-05-21)
6+
7+
[Full changelog](https://github.com/mozilla/glean.js/compare/v0.14.0...v0.14.1)
8+
9+
* [#342](https://github.com/mozilla/glean.js/pull/342): BUGFIX: Fix timespan payload representatin to match exactly the payload expected according to the Glean schema.
10+
* [#343](https://github.com/mozilla/glean.js/pull/343): BUGFIX: Report the correct failure exit code when the Glean command line tool fails.
411

512
# v0.14.0 (2021-05-19)
613

714
[Full changelog](https://github.com/mozilla/glean.js/compare/v0.13.0...v0.14.0)
815

916
* [#313](https://github.com/mozilla/glean.js/pull/313): Send Glean.js version and platform information on X-Telemetry-Agent header instead of User-Agent header.
17+
1018
# v0.13.0 (2021-05-18)
1119

1220
[Full changelog](https://github.com/mozilla/glean.js/compare/v0.12.0...v0.13.0)

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@
44

55
`Glean.js` is a modern approach for a Telemetry library aimed at Javascript environments. It is part of the [Glean project](https://docs.telemetry.mozilla.org/concepts/glean/glean.html).
66

7+
## Documentation
8+
9+
All documentation is available online:
10+
11+
### [The Glean Book](https://mozilla.github.io/glean/)
12+
13+
If you are using Glean.js in your project, this is the place to go.
14+
It contains user guides on getting started and other topics, as well as reference to Glean APIs.
15+
16+
### [Glean.js developer documentation](https://github.com/mozilla/glean.js/tree/main/docs)
17+
18+
If you want to contribute to the Glean.js code base this is the place to go.
19+
20+
### [Glean.js internal reference](https://mozilla.github.io/glean.js/)
21+
22+
If you are looking for detailed documentation on the Glean APIs (internal or external) this is the place to go.
23+
24+
_This documentation is autogenererated from the doc comments throughout the Glean.js codebase and
25+
the Glean book should be preferred over this documentation whenever possible._
26+
727
## Contact
828

929
To contact us you can:

bin/parser-for-schema-testing.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env bash
2+
#
3+
# This Source Code Form is subject to the terms of the Mozilla Public
4+
# License, v. 2.0. If a copy of the MPL was not distributed with this
5+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
6+
7+
set -eo pipefail
8+
9+
run() {
10+
[ "${VERB:-0}" != 0 ] && echo "+ $*"
11+
"$@"
12+
}
13+
14+
# All sed commands below work with either
15+
# GNU sed (standard on Linux distrubtions) or BSD sed (standard on macOS)
16+
SED="sed"
17+
18+
WORKSPACE_ROOT="$( cd "$(dirname "$0")/.." ; pwd -P )"
19+
20+
# Generate files using the Glean.js CLI tool (which just runs glean_parser)
21+
npm run cli -- \
22+
translate tests/integration/schema/metrics.yaml tests/integration/schema/pings.yaml \
23+
-f typescript \
24+
-o tests/integration/schema/generated
25+
26+
# Update metrics import path
27+
FILE=glean/tests/integration/schema/generated/forTesting.ts
28+
run $SED -i.bak -E \
29+
-e 's#@mozilla/glean/webext/private/metrics#../../../../src/core/metrics/types#g' \
30+
"${WORKSPACE_ROOT}/${FILE}"
31+
run rm "${WORKSPACE_ROOT}/${FILE}.bak"
32+
33+
# Update ping import path
34+
FILE=glean/tests/integration/schema/generated/pings.ts
35+
run $SED -i.bak -E \
36+
-e 's#@mozilla/glean/webext/private/ping#../../../../src/core/pings/ping_type.js#g' \
37+
"${WORKSPACE_ROOT}/${FILE}"
38+
run rm "${WORKSPACE_ROOT}/${FILE}.bak"
39+

bin/update-glean-parser-version.sh

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/usr/bin/env bash
2+
#
3+
# This Source Code Form is subject to the terms of the Mozilla Public
4+
# License, v. 2.0. If a copy of the MPL was not distributed with this
5+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
6+
7+
# Update the glean_parser version
8+
9+
set -eo pipefail
10+
11+
run() {
12+
[ "${VERB:-0}" != 0 ] && echo "+ $*"
13+
"$@"
14+
}
15+
16+
# All sed commands below work with either
17+
# GNU sed (standard on Linux distrubtions) or BSD sed (standard on macOS)
18+
SED="sed"
19+
20+
WORKSPACE_ROOT="$( cd "$(dirname "$0")/.." ; pwd -P )"
21+
22+
if [ -z "$1" ]; then
23+
echo "Usage: $(basename "$0") <new version>"
24+
echo
25+
echo "Update the glean_parser version"
26+
exit 1
27+
fi
28+
29+
NEW_VERSION="$1"
30+
31+
# GIT_STATUS_OUTPUT=$(git status --untracked-files=no --porcelain)
32+
# if [ -z "$ALLOW_DIRTY" ] && [ -n "${GIT_STATUS_OUTPUT}" ]; then
33+
# lines=$(echo "$GIT_STATUS_OUTPUT" | wc -l | tr -d '[:space:]')
34+
# echo "error: ${lines} files in the working directory contain changes that were not yet committed into git:"
35+
# echo
36+
# echo "${GIT_STATUS_OUTPUT}"
37+
# echo
38+
# exit 1
39+
# fi
40+
41+
# Update the version in glean/src/cli.ts
42+
FILE=glean/src/cli.ts
43+
run $SED -i.bak -E \
44+
-e "s/const GLEAN_PARSER_VERSION = \"[0-9.]+\"/const GLEAN_PARSER_VERSION = \"${NEW_VERSION}\"/" \
45+
"${WORKSPACE_ROOT}/${FILE}"
46+
run rm "${WORKSPACE_ROOT}/${FILE}.bak"
47+
48+
# Update the version in samples/qt-qml-app/requirements.txt
49+
FILE=samples/qt-qml-app/requirements.txt
50+
run $SED -i.bak -E \
51+
-e "s/glean_parser==[0-9.]+/glean_parser==${NEW_VERSION}/" \
52+
"${WORKSPACE_ROOT}/${FILE}"
53+
run rm "${WORKSPACE_ROOT}/${FILE}.bak"
54+
55+
echo "glean_parser updated to v${NEW_VERSION}"
56+
echo
57+
echo "Changed files:"
58+
git status --untracked-files=no --porcelain || true
59+
echo
60+
echo "Create update commit v${NEW_VERSION} now? [y/N]"
61+
read -r RESP
62+
echo
63+
if [ "$RESP" != "y" ] && [ "$RESP" != "Y" ]; then
64+
echo "No new commit. No new tag. Proceed manually."
65+
exit 0
66+
fi
67+
68+
run git add --update "${WORKSPACE_ROOT}"
69+
run git commit --message "Bumped glean_parser version to ${NEW_VERSION}"
70+
71+
if git remote | grep -q upstream; then
72+
remote=upstream
73+
else
74+
remote=origin
75+
fi
76+
branch=$(git rev-parse --abbrev-ref HEAD)
77+
78+
echo "Don't forget to push this commit:"
79+
echo
80+
echo " git push $remote $branch"
81+

docs/adding_a_new_metric_type.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ async function testGetValue(ping: string = this.sendInPings[0]): Promise<string
171171
172172
## Testing
173173

174-
Tests for metric type implementations live under the `glean/tests/core/metrics/types` folder. Create a new
174+
Tests for metric type implementations live under the `glean/tests/unit/core/metrics/types` folder. Create a new
175175
file with the same name as the one you created in `glean/src/core/metrics/types` to accomodate your
176176
metric type tests.
177177

@@ -181,6 +181,17 @@ Make sure your tests cover at least your metric types basic functionality:
181181
- The metric correctly reports errors;
182182
- The metric returns the correct value when it has value.
183183

184+
### Glean schema
185+
186+
It is very important to also check if the new metric payload is valid against the Glean schema.
187+
Declare a new instance of the metrics you just implemented in `glean/test/integration/schema/metrics.yaml`
188+
and then make sure you record to that metrics on the `validate generated ping is valid against glean schema`
189+
test on the `glean/test/integration/schema/schema.spec.ts` test.
190+
191+
This test will fail unless schema changes to accomodate the new metric type have already landed.
192+
Please see the [mozilla-pipeline-schemas](#mozilla-pipeline-schemas) section on how to add new metric
193+
types to the Glean schema.
194+
184195
## Documentation
185196

186197
Glean.js' has linter rules that enforce [JSDoc](https://jsdoc.app/) strings on every public function.

docs/getting_started.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,29 @@ npm run test
2828
```
2929
in the `glean` folder.
3030

31-
This runs all the tests in the `glean` folder.
31+
This runs all the tests in the `glean` folder.
3232
Alternatively, you may want to run component-specific tests.
3333
To do so, substitute `test` in the command above with one of the followings:
34-
* `test:core` - executes tests inside `tests/core` folder.
35-
* `test:plugins` - executes tests inside `tests/plugins` folder.
36-
* `test:platform` - executes tests inside `tests/platform` folder.
34+
35+
* `test:unit:core` - executes tests inside `tests/unit/core` folder.
36+
* `test:unit:plugins` - executes tests inside `tests/unit/plugins` folder.
37+
* `test:unit:platform` - executes tests inside `tests/unit/platform` folder.
38+
* `test:integration` - executes tests inside `tests/integration` folder.
3739

3840
You might want to run one specific test within a certain folder.
3941
To run the test with the title `DatetimeMetric` in the `core` folder:
4042
```bash
41-
npm run test:core -- --grep "DateTimeMetric"
43+
npm run test:unit:core -- --grep "DateTimeMetric"
4244
```
4345
You should see the output similar to the following:
4446
```shell
4547

46-
> @mozilla/glean@0.10.2 test:core
47-
> npm run test:base -- "tests/core/**/*.spec.ts" --recursive "--grep" "DatetimeMetric"
48+
> @mozilla/glean@0.10.2 test:unit:core
49+
> npm run test:base -- "tests/unit/core/**/*.spec.ts" --recursive "--grep" "DatetimeMetric"
4850

4951

5052
> @mozilla/glean@0.10.2 test:base
51-
> node --experimental-modules --experimental-specifier-resolution=node --loader=ts-node/esm node_modules/mocha/lib/cli/cli.js "tests/core/**/*.spec.ts" "--recursive" "--grep" "DatetimeMetric"
53+
> node --experimental-modules --experimental-specifier-resolution=node --loader=ts-node/esm node_modules/mocha/lib/cli/cli.js "tests/unit/core/**/*.spec.ts" "--recursive" "--grep" "DatetimeMetric"
5254

5355
(node:52217) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
5456
(Use `node --trace-warnings ...` to show where the warning was created)

docs/update_glean_parser.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Updating the glean_parser version
2+
3+
To update the version of glean_parser used by the Glean.js, run the `bin/update-glean-parser-version.sh` script, providing the version as a command line parameter:
4+
5+
```bash
6+
bin/update-glean-parser-version.sh 1.28.3
7+
```
8+
9+
This will update the version in all the required places and create a commit with the changes. After that you just need to create a pull request with the changes.
10+
11+
No further action is required.

0 commit comments

Comments
 (0)