Skip to content

Commit 9885dc9

Browse files
authored
Merge pull request #431 from Dexterp37/events_tresh
[no bug] Record the events timestamp before dispatching
2 parents c8b00b6 + 96d9b8d commit 9885dc9

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* [#415](https://github.com/mozilla/glean.js/pull/415): Gzip ping paylod before upload
99
* This changes the signature of `Uploader.post` to accept `string | Uint8Array` for the `body` parameter, instead of only `string`.
1010
* The gizpping functionality is disabled in Qt/QML environments. Follow [Bug 1716322](https://bugzilla.mozilla.org/show_bug.cgi?id=1716322) for updates on the status of this feature on that platform.
11+
* [#431](https://github.com/mozilla/glean.js/pull/431): BUGFIX: Record the timestamp for events before dispatching to the internal task queue.
1112

1213
# v0.15.0 (2021-06-03)
1314

glean/src/core/metrics/types/event.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ class EventMetricType extends MetricType {
3333
* The maximum length for values is 100 bytes.
3434
*/
3535
record(extra?: ExtraMap): void {
36+
const timestamp = getMonotonicNow();
37+
3638
Context.dispatcher.launch(async () => {
3739
if (!this.shouldRecord(Context.uploadEnabled)) {
3840
return;
3941
}
4042

41-
const timestamp = getMonotonicNow();
42-
4343
// Truncate the extra keys, if needed.
4444
let truncatedExtra: ExtraMap | undefined = undefined;
4545
if (extra && this.allowedExtraKeys) {

glean/src/metrics.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,16 @@ glean.internal.metrics:
222222
expires: never
223223

224224
seq:
225-
type: string
225+
type: counter
226226
lifetime: user
227227
send_in_pings:
228228
- glean_internal_info
229229
description: |
230-
A running counter of the number of times pings of this type have been sent
230+
A running counter of the number of times pings of this type have been
231+
sent.
232+
This metric definition is only used for documentation purposes:
233+
internally, Glean instantiates the metric manually and calls it
234+
`sequence`.
231235
bugs:
232236
- https://bugzilla.mozilla.org/show_bug.cgi?id=1556964
233237
data_reviews:

0 commit comments

Comments
 (0)