Skip to content

Commit e165e69

Browse files
committed
Merge branch 'release-v1.1.0' into release
2 parents 380155c + 7aa3022 commit e165e69

Some content is hidden

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

44 files changed

+2342
-1576
lines changed

.circleci/config.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ jobs:
179179
pip install -r requirements.txt
180180
glean_parser translate src/App/metrics.yaml src/App/pings.yaml \
181181
-f javascript -o src/App/generated \
182-
--option platform=qt --option version="1.0"
182+
--option platform=qt --option version="1.1"
183183
- run:
184184
name: Run Qt sample tests
185185
command: |
@@ -237,8 +237,8 @@ jobs:
237237
eval "$(ssh-agent -s)"
238238
DECODED_SSH_DEPLOY_KEY=$(echo $SSH_DEPLOY_KEY | base64 -d)
239239
ssh-add - \<<< "${DECODED_SSH_DEPLOY_KEY}"
240-
git config user.email "brizental+moz-glean@mozilla.com"
241-
git config user.name "moz-glean"
240+
git config user.email "dataops+ci-bot@mozilla.com"
241+
git config user.name "dataops-ci-bot"
242242
npm --prefix ./glean run publish:docs
243243
244244
publish:
@@ -310,26 +310,26 @@ workflows:
310310
- release
311311
- /^release-.*/
312312
- check-size:
313-
context: data-eng-gleanjs-gh
313+
context: data-sre-gleanjs
314314
requires:
315315
- hold
316316
- browser-compat-smoke-tests:
317-
context: data-eng-gleanjs-gh
317+
context: data-sre-gleanjs
318318
filters:
319319
branches:
320320
only:
321321
- main
322322
- release
323323
- /^release-.*/
324324
- docs-deploy:
325-
context: data-eng-gleanjs-gh
325+
context: data-sre-gleanjs
326326
filters:
327327
branches:
328328
ignore: /.*/
329329
tags:
330330
only: /^v.*/
331331
- publish:
332-
context: data-eng-gleanjs-gh
332+
context: data-sre-gleanjs
333333
filters:
334334
branches:
335335
ignore: /.*/

.dictionary

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
personal_ws-1.1 en 72
1+
personal_ws-1.1 en 73
22
API's
33
APIs
44
BUGFIX
@@ -44,6 +44,7 @@ enqueued
4444
enum
4545
falsy
4646
firefox
47+
getters
4748
gzip
4849
gzipping
4950
init

.github/auto_assign.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ reviewers:
44
- badboy
55
- Dexterp37
66
- travis79
7-
- brizental
87
- chutten
98
numberOfReviewers: 1
109
skipKeywords:
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
name: Glean probe-scraper
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
jobs:
9+
glean-probe-scraper:
10+
uses: mozilla/probe-scraper/.github/workflows/glean.yaml@main

ARCHITECTURE.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Architecture
2+
3+
This document aims to give a high level overview of the
4+
Glean JavaScript SDK (aka Glean.js) architecture.
5+
6+
This is a great place to start for newcomers to the project.
7+
8+
For in-depth documentation on specific implementation details of the library, refer to
9+
the [Glean.js developer documentation](docs/README.md).
10+
11+
## Context
12+
13+
The Glean JavaScript SDK is part of [the Glean project](https://docs.telemetry.mozilla.org/concepts/glean/glean.html).
14+
An end-to-end data collection platform developed by Mozilla and primarily targeting Mozilla products
15+
across multiple platforms.
16+
17+
Glean provides multiple client SDKs for different programming languages and platforms.
18+
One of the aspects that guide Glean SDK development is cross-platform consistency and the Glean
19+
JavaScript SDK is no exception to that. It is built to work on multiple JavaScript platforms --
20+
websites, web extensions, Node.js and QML as of the time of writing -- and to be easily extendable
21+
to other platforms as well.
22+
23+
The Glean JavaScript SDK is the latest addition to the family of Glean SDKs. The other Glean SDKs,
24+
namely Kotlin, Swift, Python, Rust and Firefox Desktop SDKs are not housed in this repository, but
25+
in the [`mozilla/glean`](https://github.com/mozilla/glean) repository and for the case of the
26+
Firefox Desktop SDK in the [mozilla-central](https://hg.mozilla.org/mozilla-central/file/tip/toolkit/components/glean) repository.
27+
28+
## Overview
29+
30+
On a very high level a Glean SDK is a library which exposes APIs for users to record
31+
structured data and submit that data in an (again) structured format to a specific endpoint.
32+
33+
Users cannot simply record arbitrary data though. The Glean SDKs expose specialized metrics APIs for
34+
different collection needs. The SDK is responsible to validating that the data given by a user is in
35+
the correct format and only then recording it (or recording an error in case the data provided is
36+
not correct).
37+
38+
When data is submitted, the Glean SDK is responsible for assembling the correct group (aka ping) of data points
39+
(aka metrics) in the format expected by the Glean pipeline, uploading the data and managing the local
40+
storage. Each metric can have different [lifetimes](https://mozilla.github.io/glean/book/user/metrics/adding-new-metrics.html#a-lifetime-example)
41+
and the SDK will manage its storage so that data does not remain in storage after it's lifetime is expired.
42+
43+
The Glean SDK tries to do all of this is the least disruptive way possible to users. All of the
44+
SDKs tasks are queued and executed asynchronously. The APIs exposed by the Glean SDK will only do
45+
the en-queuing of tasks, a quick synchronous operation. Internally, the Glean SDK will handle the
46+
queued tasks asynchronously, catching any errors thrown along the way so that Glean never
47+
crashes a users application.
48+
49+
## Code Map
50+
51+
The Glean JavaScript SDK source code lives under the `glean/src` folder.
52+
53+
```
54+
├── core/ # Contains the bulk of the library's implementation
55+
├── entry/ # Contains the different general API entry points for each platform
56+
├── platform/ # Contains platforms specific implementations for specific modules
57+
├── plugins/ # Contains plugins implementations
58+
├── cli.ts # Contains the Glean CLI implementation
59+
├── metrics.yaml
60+
└── pings.yaml
61+
```
62+
63+
### `core/`
64+
65+
The `core/` folder is where developers will probably spend most of their time
66+
when working on Glean.js. This folder contains the majority of the library implementation.
67+
68+
All of the code under this folder is expected to work across all platforms. Platform specific code
69+
is centralized on the `platform/` folder which is covered in a later section of this document.
70+
71+
`glean.ts` contains the Glean [general API](https://mozilla.github.io/glean/book/reference/general/index.html)
72+
implementation where Glean state is initialized and managed. Due to its centralizer aspect,
73+
this file inevitably imports many of the other files on the library. As such,
74+
developers should avoid importing this file in any of the other files on the `core/` folder,
75+
because that can quickly cause a circular dependency mess.
76+
77+
`context.ts` is where circular dependencies go to die. When Glean.js was first implemented,
78+
`glean.ts` not only managed and initialized Glean state, but it also exposed Glean state to the rest
79+
of the library. That caused a huge issue with circular dependencies. The `context.ts` file was
80+
created to mitigate that issue. This file houses the `Context` structure, a singleton that holds
81+
setters and getters to all of Glean's internal state. This file should avoid any imports that are
82+
not `import type`.
83+
84+
`dispatcher.ts` is where Glean's dispatcher implementation lives. The dispatcher is the structure
85+
that manages Glean's task queue.
86+
87+
`metrics/types` is where all of the specific metric type implementations are. Each metric type
88+
should be implemented in a single file and no other file types should be added to this folder,
89+
because the files under this folder are exposed through the `@mozilla/glean/private/metrics/*`
90+
entry point.
91+
92+
To see all the exposed entry points, check out Glean.js' `package.json` file.
93+
94+
### `entry/`
95+
96+
The `entry/` folder contains the main entry points for the Glean.js package per platform.
97+
For example, when a user does `import Glean from @mozilla/glean/webext` it's the `entry/webext.ts`
98+
file that they are getting and not `core/glean.ts`.
99+
100+
The main difference between each platform's file is that a different `Platform` implementation is
101+
imported per file.
102+
103+
The Qt/QML entry point is the different one here. QML packages cannot be easily consumed through npm,
104+
so the QML entry point imports all of Glean's modules and exposes it through this entry point. That is
105+
what is done on the `qt.ts` file. The `qt.js` file is the file QML users actually interact with,
106+
it includes specific QML semantics and is copied to the final destination folder of the QML package
107+
as-is after Glean.js is compiled for the QML target. (See `bin/prepare-qml-module.sh` for more
108+
context.)
109+
110+
### `platform/`
111+
112+
Some modules such as storage and uploader, cannot be written in such a way that works
113+
for all platforms, because each platform provides different APIs for these tasks. In order
114+
for useless platform specific code not to bloat the size of the library on each platform,
115+
the `platform/` module contains implementations of identical interfaces in different platforms.
116+
117+
This allows the pattern of only importing the necessary implementation of these modules on each
118+
platform. It also makes testing easier, because the exact same suite of tests can run for each of
119+
the platform specific implementation, thus guaranteeing that each modules works exactly the same
120+
in all platforms.
121+
122+
### `plugins/`
123+
124+
The `plugins/` folder contains the Glean.js' plugins code.
125+
126+
Each plugin is expected to be implemented in a single file, because these files are
127+
exposed through the `@mozilla/glean/plugins/*` entry point.
128+
129+
### `cli.ts`
130+
131+
This file is what gets executed when a user that has installed Glean through npm invokes the `glean`
132+
command. It serves as a wrapper to call `glean_parser` commands more easily from JavaScript projects.

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/v1.0.0...main)
3+
[Full changelog](https://github.com/mozilla/glean.js/compare/v1.1.0...main)
4+
5+
# v1.1.0 (2022-07-18)
6+
7+
[Full changelog](https://github.com/mozilla/glean.js/compare/v1.0.0...v1.1.0)
8+
9+
* [#1318](https://github.com/mozilla/glean.js/pull/1318): Expose `ErrorType` through its own entry point.
10+
* [#1271](https://github.com/mozilla/glean.js/pull/1271): BUGFIX: Fix pings validation function when scanning pings database on initialize.
11+
* This bug was preventing pings that contained custom headers from being successfully validated and enqueued on initialize.
12+
* [#1335](https://github.com/mozilla/glean.js/pull/1335): BUGFIX: Fix uploading gzip-compressed pings in Node.
13+
* [#1415](https://github.com/mozilla/glean.js/pull/1415): BUGFIX: Publish the TS type information for the `web` platform.
414

515
# v1.0.0 (2022-03-17)
616

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ Here's the [guide](https://github.com/mozilla/glean.js/blob/main/docs/guides/get
1919

2020
If you are using Glean.js and found a bug or a missing feature, please file a bug.
2121

22-
Glean.js bugs are filed in Bugzilla. Use [this link](https://bugzilla.mozilla.org/enter_bug.cgi?product=Data+Platform+and+Tools&component=Glean.js&priority=P4&status_whiteboard=%5Btelemetry%3Aglean-js%3Am%3F%5D)
23-
to file a bug in the Glean.js Bugzilla component.
22+
Glean.js bugs are filed in Bugzilla. Use [this link](https://bugzilla.mozilla.org/enter_bug.cgi?assigned_to=nobody%40mozilla.org&bug_ignored=0&bug_severity=normal&bug_status=NEW&bug_type=defect&cf_fx_iteration=---&cf_fx_points=---&cf_status_firefox100=---&cf_status_firefox101=---&cf_status_firefox99=---&cf_status_firefox_esr91=---&cf_tracking_firefox100=---&cf_tracking_firefox101=---&cf_tracking_firefox99=---&cf_tracking_firefox_esr91=---&component=Glean%3A%20SDK&contenttypemethod=list&contenttypeselection=text%2Fplain&defined_groups=1&filed_via=standard_form&flag_type-4=X&flag_type-607=X&flag_type-721=X&flag_type-737=X&flag_type-799=X&flag_type-800=X&flag_type-803=X&flag_type-936=X&flag_type-947=X&form_name=enter_bug&maketemplate=Remember%20values%20as%20bookmarkable%20template&op_sys=Unspecified&priority=P3&product=Data%20Platform%20and%20Tools&rep_platform=Unspecified&status_whiteboard=%5Bglean-sdk%3Am%3F%5D%5Bglean-js%5D&target_milestone=---&version=unspecified)
23+
to file a bug in the Glean SDK Bugzilla component.
2424

2525
## Finding a bug to work on
2626

27-
As mentioned, Glean.js bugs are filed in Bugzilla. Anything on the Glean.js component
28-
with the tag [`[good first bug]`](https://bugzilla.mozilla.org/buglist.cgi?f1=status_whiteboard&v1=%5Bgood%20first%20bug%5D&o1=substring&resolution=---&query_format=advanced&f2=component&v2=Glean.js&list_id=15653400&o2=equals&classification=Client%20Software&classification=Developer%20Infrastructure&classification=Components&classification=Server%20Software&classification=Other)
27+
As mentioned, Glean.js bugs are filed in Bugzilla. Anything on the Glean SDK component
28+
with the tag [`[good first bug]`](https://bugzilla.mozilla.org/buglist.cgi?f1=status_whiteboard&o1=substring&component=Glean%3A%20SDK&query_format=advanced&resolution=---&classification=Client%20Software&classification=Developer%20Infrastructure&classification=Components&classification=Server%20Software&classification=Other&v1=%5Bgood-first-bug%5D%5Bglean-js%5D&list_id=16044682)
2929
is a good place to start.
3030

3131
These bugs will usually have a comment explaining the steps to get started working on them.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ the Glean book should be preferred over this documentation whenever possible._
2929
To contact us you can:
3030

3131
* Find us in the [#glean channel on chat.mozilla.org](https://chat.mozilla.org/#/room/#glean:mozilla.org).
32-
* To report issues or request changes, file a bug in [Bugzilla in Data Platform & Tools :: Glean.js](https://bugzilla.mozilla.org/enter_bug.cgi?product=Data+Platform+and+Tools&component=Glean.js&priority=P4&status_whiteboard=%5Btelemetry%3Aglean-js%3Am%3F%5D).
32+
* To report issues or request changes, file a bug in [Bugzilla in Data Platform & Tools :: Glean SDK](https://bugzilla.mozilla.org/enter_bug.cgi?assigned_to=nobody%40mozilla.org&bug_ignored=0&bug_severity=normal&bug_status=NEW&bug_type=defect&cf_fx_iteration=---&cf_fx_points=---&cf_status_firefox100=---&cf_status_firefox101=---&cf_status_firefox99=---&cf_status_firefox_esr91=---&cf_tracking_firefox100=---&cf_tracking_firefox101=---&cf_tracking_firefox99=---&cf_tracking_firefox_esr91=---&component=Glean%3A%20SDK&contenttypemethod=list&contenttypeselection=text%2Fplain&defined_groups=1&filed_via=standard_form&flag_type-4=X&flag_type-607=X&flag_type-721=X&flag_type-737=X&flag_type-799=X&flag_type-800=X&flag_type-803=X&flag_type-936=X&flag_type-947=X&form_name=enter_bug&maketemplate=Remember%20values%20as%20bookmarkable%20template&op_sys=Unspecified&priority=P3&product=Data%20Platform%20and%20Tools&rep_platform=Unspecified&status_whiteboard=%5Bglean-sdk%3Am%3F%5D%5Bglean-js%5D&target_milestone=---&version=unspecified).
3333
* Send an email to *glean-team@mozilla.com*.
34-
* The Glean Core team is: *:dexter*, *:janerik*, *:mdroettboom*, *:travis_*, *:chutten*, *:brizental*.
34+
* The Glean SDKs team is: *:dexter*, *:janerik*, *:travis_*, *:chutten*.
3535

3636
## Credits
3737

0 commit comments

Comments
 (0)