Skip to content

Commit 5fc3cc3

Browse files
committed
Merge branch 'main' into bug_1699391
2 parents 67756f8 + d271892 commit 5fc3cc3

Some content is hidden

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

42 files changed

+1018
-579
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ jobs:
102102
python3 -m venv venv
103103
source venv/bin/activate
104104
pip install -r requirements.txt
105+
glean_parser translate metrics.yaml pings.yaml -f javascript -o generated --option platform=qt
105106
106107
sudo apt-get install xvfb
107108
xvfb-run python main.py &> qml.log &

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
[Full changelog](https://github.com/mozilla/glean.js/compare/v0.10.2...main)
44

5+
* [#260](https://github.com/mozilla/glean.js/pull/260): Set minimum node (>= 12.0.0) and npm (>= 7.0.0) versions.
56
* [#202](https://github.com/mozilla/glean.js/pull/202): Add a testing API for the ping type.
7+
* [#253](https://github.com/mozilla/glean.js/pull/253): Implement the timespan metric type.
68
* [#261](https://github.com/mozilla/glean.js/pull/261): Show a spinner while setting up python virtual environment
79

810
# v0.10.2 (2021-04-26)

glean/package-lock.json

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

glean/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"@typescript-eslint/eslint-plugin": "^4.15.0",
7676
"@typescript-eslint/parser": "^4.15.1",
7777
"eslint": "^7.19.0",
78-
"eslint-plugin-jsdoc": "^32.0.1",
78+
"eslint-plugin-jsdoc": "^33.0.0",
7979
"eslint-plugin-json": "^2.1.2",
8080
"eslint-plugin-mocha": "^8.0.0",
8181
"eslint-plugin-notice": "^0.9.10",
@@ -96,5 +96,9 @@
9696
"dependencies": {
9797
"jose": "^3.7.0",
9898
"uuid": "^8.3.2"
99+
},
100+
"engines": {
101+
"node": ">=12.20.0",
102+
"npm": ">=7.0.0"
99103
}
100104
}

glean/src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { promisify } from "util";
1515
const VIRTUAL_ENVIRONMENT_DIR = ".venv";
1616

1717
// The version of glean_parser to install from PyPI.
18-
const GLEAN_PARSER_VERSION = "3.1.1";
18+
const GLEAN_PARSER_VERSION = "3.2.0";
1919

2020
// This script runs a given Python module as a "main" module, like
2121
// `python -m module`. However, it first checks that the installed

glean/src/core/glean.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ import { isUndefined, sanitizeApplicationId } from "./utils.js";
1212
import { CoreMetrics } from "./internal_metrics.js";
1313
import EventsDatabase from "./metrics/events_database.js";
1414
import UUIDMetricType from "./metrics/types/uuid.js";
15-
import DatetimeMetricType from "./metrics/types/datetime.js";
16-
import { DatetimeMetric } from "./metrics/types/datetime_metric.js";
15+
import DatetimeMetricType, { DatetimeMetric } from "./metrics/types/datetime.js";
1716
import CorePings from "./internal_pings.js";
1817
import { registerPluginToEvent, testResetEvents } from "./events/utils.js";
1918

glean/src/core/metrics/database.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
import type Store from "../storage/index.js";
66
import type { MetricType } from "./index.js";
77
import type { Metric } from "./metric.js";
8-
import { createMetric, validateMetricInternalRepresentation } from "./utils.js";
8+
import type { StorageBuilder } from "../../platform/index.js";
9+
import type { Metrics } from "./index.js";
910
import type { JSONObject, JSONValue } from "../utils.js";
11+
import { createMetric, validateMetricInternalRepresentation } from "./utils.js";
1012
import { isObject, isUndefined } from "../utils.js";
11-
import type { StorageBuilder } from "../../platform/index.js";
12-
import type { Metrics } from "./metrics_interface";
1313
import { Lifetime } from "./lifetime.js";
1414

1515
/**

glean/src/core/metrics/index.ts

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

55
import type { JSONValue } from "../utils.js";
6-
import { isUndefined } from "../utils.js";
7-
import { Metric } from "./metric.js";
86
import type { Lifetime } from "./lifetime.js";
97
import type MetricsDatabase from "./database.js";
10-
import { getValidDynamicLabel } from "./types/labeled_utils.js";
8+
import { isUndefined } from "../utils.js";
9+
import { getValidDynamicLabel } from "./types/labeled.js";
10+
11+
export interface Metrics {
12+
[aMetricType: string]: {
13+
[aMetricIdentifier: string]: JSONValue;
14+
};
15+
}
16+
1117

1218
/**
1319
* The common set of data shared across all different metric types.
@@ -103,27 +109,3 @@ export abstract class MetricType implements CommonMetricData {
103109
return (uploadEnabled && !this.disabled);
104110
}
105111
}
106-
107-
/**
108-
* This is an internal metric representation for labeled metrics.
109-
*
110-
* This can be used to instruct the validators to simply report
111-
* whatever is stored internally, without performing any specific
112-
* validation.
113-
*
114-
* This needs to live here, instead of labeled.ts, in order to avoid
115-
* a cyclic dependency.
116-
*/
117-
export class LabeledMetric extends Metric<JSONValue, JSONValue> {
118-
constructor(v: unknown) {
119-
super(v);
120-
}
121-
122-
validate(v: unknown): v is JSONValue {
123-
return true;
124-
}
125-
126-
payload(): JSONValue {
127-
return this._inner;
128-
}
129-
}

glean/src/core/metrics/metrics_interface.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,23 @@
44

55
import type { CommonMetricData } from "../index.js";
66
import { MetricType } from "../index.js";
7-
import { BooleanMetric } from "./boolean_metric.js";
87
import { Context } from "../../context.js";
8+
import { Metric } from "../metric.js";
9+
import { isBoolean } from "../../utils.js";
10+
11+
export class BooleanMetric extends Metric<boolean, boolean> {
12+
constructor(v: unknown) {
13+
super(v);
14+
}
15+
16+
validate(v: unknown): v is boolean {
17+
return isBoolean(v);
18+
}
19+
payload(): boolean {
20+
return this._inner;
21+
}
22+
}
23+
924

1025
/**
1126
* A boolean metric.

0 commit comments

Comments
 (0)