@theia/metrics 1.48.1 → 1.48.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -30
- package/lib/browser/metrics-frontend-application-contribution.d.ts +12 -12
- package/lib/browser/metrics-frontend-application-contribution.js +58 -58
- package/lib/browser/metrics-frontend-module.d.ts +3 -3
- package/lib/browser/metrics-frontend-module.js +28 -28
- package/lib/common/index.d.ts +1 -1
- package/lib/common/index.js +19 -19
- package/lib/common/measurement-notification-service.d.ts +11 -11
- package/lib/common/measurement-notification-service.js +20 -20
- package/lib/electron-node/electron-metrics-backend-module.d.ts +3 -3
- package/lib/electron-node/electron-metrics-backend-module.js +24 -24
- package/lib/electron-node/electron-token-validator.d.ts +9 -9
- package/lib/electron-node/electron-token-validator.js +43 -43
- package/lib/node/extensions-metrics-contribution.d.ts +8 -8
- package/lib/node/extensions-metrics-contribution.js +54 -54
- package/lib/node/index.d.ts +5 -5
- package/lib/node/index.js +23 -23
- package/lib/node/measurement-metrics-contribution.d.ts +17 -17
- package/lib/node/measurement-metrics-contribution.js +75 -75
- package/lib/node/metrics-backend-application-contribution.d.ts +16 -16
- package/lib/node/metrics-backend-application-contribution.js +50 -50
- package/lib/node/metrics-backend-module.d.ts +3 -3
- package/lib/node/metrics-backend-module.js +35 -35
- package/lib/node/metrics-contribution.d.ts +5 -5
- package/lib/node/metrics-contribution.js +19 -19
- package/lib/node/node-metrics-contribution.d.ts +5 -5
- package/lib/node/node-metrics-contribution.js +35 -35
- package/lib/node/prometheus.d.ts +2 -2
- package/lib/node/prometheus.js +27 -27
- package/lib/node/prometheus.spec.d.ts +1 -1
- package/lib/node/prometheus.spec.js +40 -40
- package/package.json +4 -4
- package/src/browser/metrics-frontend-application-contribution.ts +51 -51
- package/src/browser/metrics-frontend-module.ts +28 -28
- package/src/common/index.ts +17 -17
- package/src/common/measurement-notification-service.ts +29 -29
- package/src/electron-node/electron-metrics-backend-module.ts +24 -24
- package/src/electron-node/electron-token-validator.ts +37 -37
- package/src/node/extensions-metrics-contribution.ts +51 -51
- package/src/node/index.ts +21 -21
- package/src/node/measurement-metrics-contribution.ts +75 -75
- package/src/node/metrics-backend-application-contribution.ts +51 -51
- package/src/node/metrics-backend-module.ts +40 -40
- package/src/node/metrics-contribution.ts +20 -20
- package/src/node/node-metrics-contribution.ts +33 -33
- package/src/node/prometheus.spec.ts +49 -49
- package/src/node/prometheus.ts +25 -25
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MetricsContribution = void 0;
|
|
4
|
-
// *****************************************************************************
|
|
5
|
-
// Copyright (C) 2018 Ericsson and others.
|
|
6
|
-
//
|
|
7
|
-
// This program and the accompanying materials are made available under the
|
|
8
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
9
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
10
|
-
//
|
|
11
|
-
// This Source Code may also be made available under the following Secondary
|
|
12
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
13
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
14
|
-
// with the GNU Classpath Exception which is available at
|
|
15
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
16
|
-
//
|
|
17
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
18
|
-
// *****************************************************************************
|
|
19
|
-
exports.MetricsContribution = Symbol('MetricsContribution');
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MetricsContribution = void 0;
|
|
4
|
+
// *****************************************************************************
|
|
5
|
+
// Copyright (C) 2018 Ericsson and others.
|
|
6
|
+
//
|
|
7
|
+
// This program and the accompanying materials are made available under the
|
|
8
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
9
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
10
|
+
//
|
|
11
|
+
// This Source Code may also be made available under the following Secondary
|
|
12
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
13
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
14
|
+
// with the GNU Classpath Exception which is available at
|
|
15
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
16
|
+
//
|
|
17
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
18
|
+
// *****************************************************************************
|
|
19
|
+
exports.MetricsContribution = Symbol('MetricsContribution');
|
|
20
20
|
//# sourceMappingURL=metrics-contribution.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MetricsContribution } from './metrics-contribution';
|
|
2
|
-
export declare class NodeMetricsContribution implements MetricsContribution {
|
|
3
|
-
getMetrics(): string;
|
|
4
|
-
startCollecting(): void;
|
|
5
|
-
}
|
|
1
|
+
import { MetricsContribution } from './metrics-contribution';
|
|
2
|
+
export declare class NodeMetricsContribution implements MetricsContribution {
|
|
3
|
+
getMetrics(): string;
|
|
4
|
+
startCollecting(): void;
|
|
5
|
+
}
|
|
6
6
|
//# sourceMappingURL=node-metrics-contribution.d.ts.map
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2018 Ericsson and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.NodeMetricsContribution = void 0;
|
|
19
|
-
const tslib_1 = require("tslib");
|
|
20
|
-
const prom = require("prom-client");
|
|
21
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
22
|
-
let NodeMetricsContribution = class NodeMetricsContribution {
|
|
23
|
-
getMetrics() {
|
|
24
|
-
return prom.register.metrics().toString();
|
|
25
|
-
}
|
|
26
|
-
startCollecting() {
|
|
27
|
-
const collectDefaultMetrics = prom.collectDefaultMetrics;
|
|
28
|
-
// Probe every 5th second.
|
|
29
|
-
collectDefaultMetrics({ timeout: 5000 });
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
NodeMetricsContribution = (0, tslib_1.__decorate)([
|
|
33
|
-
(0, inversify_1.injectable)()
|
|
34
|
-
], NodeMetricsContribution);
|
|
35
|
-
exports.NodeMetricsContribution = NodeMetricsContribution;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2018 Ericsson and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.NodeMetricsContribution = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
20
|
+
const prom = require("prom-client");
|
|
21
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
22
|
+
let NodeMetricsContribution = class NodeMetricsContribution {
|
|
23
|
+
getMetrics() {
|
|
24
|
+
return prom.register.metrics().toString();
|
|
25
|
+
}
|
|
26
|
+
startCollecting() {
|
|
27
|
+
const collectDefaultMetrics = prom.collectDefaultMetrics;
|
|
28
|
+
// Probe every 5th second.
|
|
29
|
+
collectDefaultMetrics({ timeout: 5000 });
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
NodeMetricsContribution = (0, tslib_1.__decorate)([
|
|
33
|
+
(0, inversify_1.injectable)()
|
|
34
|
+
], NodeMetricsContribution);
|
|
35
|
+
exports.NodeMetricsContribution = NodeMetricsContribution;
|
|
36
36
|
//# sourceMappingURL=node-metrics-contribution.js.map
|
package/lib/node/prometheus.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function toPrometheusValidName(name: string): string;
|
|
2
|
-
export declare const PROMETHEUS_REGEXP: RegExp;
|
|
1
|
+
export declare function toPrometheusValidName(name: string): string;
|
|
2
|
+
export declare const PROMETHEUS_REGEXP: RegExp;
|
|
3
3
|
//# sourceMappingURL=prometheus.d.ts.map
|
package/lib/node/prometheus.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2018 Ericsson and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.PROMETHEUS_REGEXP = exports.toPrometheusValidName = void 0;
|
|
19
|
-
function toPrometheusValidName(name) {
|
|
20
|
-
/* Make sure that start of name is valid and respect [a-zA-Z_:] */
|
|
21
|
-
const validFirstCharString = name.replace(/(^[^a-zA-Z_:]+)/gi, '');
|
|
22
|
-
/* Make sure that rest of the name respect [a-zA-Z0-9_:]* */
|
|
23
|
-
const validPrometheusName = validFirstCharString.replace(/([^a-zA-Z0-9_:])/gi, '_');
|
|
24
|
-
return validPrometheusName;
|
|
25
|
-
}
|
|
26
|
-
exports.toPrometheusValidName = toPrometheusValidName;
|
|
27
|
-
exports.PROMETHEUS_REGEXP = /^[a-zA-Z_:][a-zA-Z0-9_:]*/;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2018 Ericsson and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.PROMETHEUS_REGEXP = exports.toPrometheusValidName = void 0;
|
|
19
|
+
function toPrometheusValidName(name) {
|
|
20
|
+
/* Make sure that start of name is valid and respect [a-zA-Z_:] */
|
|
21
|
+
const validFirstCharString = name.replace(/(^[^a-zA-Z_:]+)/gi, '');
|
|
22
|
+
/* Make sure that rest of the name respect [a-zA-Z0-9_:]* */
|
|
23
|
+
const validPrometheusName = validFirstCharString.replace(/([^a-zA-Z0-9_:])/gi, '_');
|
|
24
|
+
return validPrometheusName;
|
|
25
|
+
}
|
|
26
|
+
exports.toPrometheusValidName = toPrometheusValidName;
|
|
27
|
+
exports.PROMETHEUS_REGEXP = /^[a-zA-Z_:][a-zA-Z0-9_:]*/;
|
|
28
28
|
//# sourceMappingURL=prometheus.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=prometheus.spec.d.ts.map
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2018 Ericsson and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
const chai = require("chai");
|
|
19
|
-
const prometheus_1 = require("./prometheus");
|
|
20
|
-
const expect = chai.expect;
|
|
21
|
-
describe('Prometheus helper module', () => {
|
|
22
|
-
/* According to https://prometheus.io/docs/concepts/data_model/ */
|
|
23
|
-
const validName = 'theia_extension3242-:';
|
|
24
|
-
const invalidTheiaName = '@theia/something';
|
|
25
|
-
const validTheiaName = 'theia_something';
|
|
26
|
-
const invalidName2 = '@theia/?$%^ ';
|
|
27
|
-
it('Should correctly validate a metric name', () => {
|
|
28
|
-
expect(prometheus_1.PROMETHEUS_REGEXP.test(validName)).to.be.true;
|
|
29
|
-
expect(prometheus_1.PROMETHEUS_REGEXP.test(invalidTheiaName)).to.be.false;
|
|
30
|
-
expect(prometheus_1.PROMETHEUS_REGEXP.test(invalidName2)).to.be.false;
|
|
31
|
-
});
|
|
32
|
-
it('Should correctly return a valid name from an otherwise invalid prometheus string', () => {
|
|
33
|
-
expect(prometheus_1.PROMETHEUS_REGEXP.test(invalidTheiaName)).to.be.false;
|
|
34
|
-
const newName = (0, prometheus_1.toPrometheusValidName)(invalidTheiaName);
|
|
35
|
-
expect(prometheus_1.PROMETHEUS_REGEXP.test(newName)).to.be.true;
|
|
36
|
-
expect(newName).to.be.equal(validTheiaName);
|
|
37
|
-
const newName2 = (0, prometheus_1.toPrometheusValidName)(invalidName2);
|
|
38
|
-
expect(prometheus_1.PROMETHEUS_REGEXP.test(newName2)).to.be.true;
|
|
39
|
-
});
|
|
40
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2018 Ericsson and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const chai = require("chai");
|
|
19
|
+
const prometheus_1 = require("./prometheus");
|
|
20
|
+
const expect = chai.expect;
|
|
21
|
+
describe('Prometheus helper module', () => {
|
|
22
|
+
/* According to https://prometheus.io/docs/concepts/data_model/ */
|
|
23
|
+
const validName = 'theia_extension3242-:';
|
|
24
|
+
const invalidTheiaName = '@theia/something';
|
|
25
|
+
const validTheiaName = 'theia_something';
|
|
26
|
+
const invalidName2 = '@theia/?$%^ ';
|
|
27
|
+
it('Should correctly validate a metric name', () => {
|
|
28
|
+
expect(prometheus_1.PROMETHEUS_REGEXP.test(validName)).to.be.true;
|
|
29
|
+
expect(prometheus_1.PROMETHEUS_REGEXP.test(invalidTheiaName)).to.be.false;
|
|
30
|
+
expect(prometheus_1.PROMETHEUS_REGEXP.test(invalidName2)).to.be.false;
|
|
31
|
+
});
|
|
32
|
+
it('Should correctly return a valid name from an otherwise invalid prometheus string', () => {
|
|
33
|
+
expect(prometheus_1.PROMETHEUS_REGEXP.test(invalidTheiaName)).to.be.false;
|
|
34
|
+
const newName = (0, prometheus_1.toPrometheusValidName)(invalidTheiaName);
|
|
35
|
+
expect(prometheus_1.PROMETHEUS_REGEXP.test(newName)).to.be.true;
|
|
36
|
+
expect(newName).to.be.equal(validTheiaName);
|
|
37
|
+
const newName2 = (0, prometheus_1.toPrometheusValidName)(invalidName2);
|
|
38
|
+
expect(prometheus_1.PROMETHEUS_REGEXP.test(newName2)).to.be.true;
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
41
|
//# sourceMappingURL=prometheus.spec.js.map
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/metrics",
|
|
3
|
-
"version": "1.48.
|
|
3
|
+
"version": "1.48.2",
|
|
4
4
|
"description": "Theia - Metrics Extension",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/core": "1.48.
|
|
6
|
+
"@theia/core": "1.48.2",
|
|
7
7
|
"prom-client": "^10.2.0",
|
|
8
8
|
"tslib": "^2.6.2"
|
|
9
9
|
},
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"watch": "theiaext watch"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@theia/ext-scripts": "1.48.
|
|
47
|
+
"@theia/ext-scripts": "1.48.2"
|
|
48
48
|
},
|
|
49
49
|
"nyc": {
|
|
50
50
|
"extends": "../../configs/nyc.json"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "0e9583d043dde303de7a0f86f68439659f8827b0"
|
|
53
53
|
}
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2023 STMicroelectronics and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
17
|
-
import { FrontendApplicationContribution } from '@theia/core/lib/browser';
|
|
18
|
-
import { ILogger, LogLevel, MeasurementResult, Stopwatch } from '@theia/core';
|
|
19
|
-
import { UUID } from '@theia/core/shared/@phosphor/coreutils';
|
|
20
|
-
import { MeasurementNotificationService } from '../common';
|
|
21
|
-
|
|
22
|
-
@injectable()
|
|
23
|
-
export class MetricsFrontendApplicationContribution implements FrontendApplicationContribution {
|
|
24
|
-
@inject(Stopwatch)
|
|
25
|
-
protected stopwatch: Stopwatch;
|
|
26
|
-
|
|
27
|
-
@inject(MeasurementNotificationService)
|
|
28
|
-
protected notificationService: MeasurementNotificationService;
|
|
29
|
-
|
|
30
|
-
@inject(ILogger)
|
|
31
|
-
protected logger: ILogger;
|
|
32
|
-
|
|
33
|
-
readonly id = UUID.uuid4();
|
|
34
|
-
|
|
35
|
-
initialize(): void {
|
|
36
|
-
this.doInitialize();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
protected async doInitialize(): Promise<void> {
|
|
40
|
-
const logLevel = await this.logger.getLogLevel();
|
|
41
|
-
if (logLevel !== LogLevel.DEBUG) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
this.stopwatch.storedMeasurements.forEach(result => this.notify(result));
|
|
45
|
-
this.stopwatch.onDidAddMeasurementResult(result => this.notify(result));
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
protected notify(result: MeasurementResult): void {
|
|
49
|
-
this.notificationService.onFrontendMeasurement(this.id, result);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2023 STMicroelectronics and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
17
|
+
import { FrontendApplicationContribution } from '@theia/core/lib/browser';
|
|
18
|
+
import { ILogger, LogLevel, MeasurementResult, Stopwatch } from '@theia/core';
|
|
19
|
+
import { UUID } from '@theia/core/shared/@phosphor/coreutils';
|
|
20
|
+
import { MeasurementNotificationService } from '../common';
|
|
21
|
+
|
|
22
|
+
@injectable()
|
|
23
|
+
export class MetricsFrontendApplicationContribution implements FrontendApplicationContribution {
|
|
24
|
+
@inject(Stopwatch)
|
|
25
|
+
protected stopwatch: Stopwatch;
|
|
26
|
+
|
|
27
|
+
@inject(MeasurementNotificationService)
|
|
28
|
+
protected notificationService: MeasurementNotificationService;
|
|
29
|
+
|
|
30
|
+
@inject(ILogger)
|
|
31
|
+
protected logger: ILogger;
|
|
32
|
+
|
|
33
|
+
readonly id = UUID.uuid4();
|
|
34
|
+
|
|
35
|
+
initialize(): void {
|
|
36
|
+
this.doInitialize();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
protected async doInitialize(): Promise<void> {
|
|
40
|
+
const logLevel = await this.logger.getLogLevel();
|
|
41
|
+
if (logLevel !== LogLevel.DEBUG) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
this.stopwatch.storedMeasurements.forEach(result => this.notify(result));
|
|
45
|
+
this.stopwatch.onDidAddMeasurementResult(result => this.notify(result));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
protected notify(result: MeasurementResult): void {
|
|
49
|
+
this.notificationService.onFrontendMeasurement(this.id, result);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2023 STMicroelectronics and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import { ContainerModule } from '@theia/core/shared/inversify';
|
|
18
|
-
import { MetricsFrontendApplicationContribution } from './metrics-frontend-application-contribution';
|
|
19
|
-
import { MeasurementNotificationService, measurementNotificationServicePath } from '../common';
|
|
20
|
-
import { FrontendApplicationContribution, WebSocketConnectionProvider } from '@theia/core/lib/browser';
|
|
21
|
-
|
|
22
|
-
export default new ContainerModule(bind => {
|
|
23
|
-
bind(FrontendApplicationContribution).to(MetricsFrontendApplicationContribution).inSingletonScope();
|
|
24
|
-
bind(MeasurementNotificationService).toDynamicValue(ctx => {
|
|
25
|
-
const connection = ctx.container.get(WebSocketConnectionProvider);
|
|
26
|
-
return connection.createProxy<MeasurementNotificationService>(measurementNotificationServicePath);
|
|
27
|
-
});
|
|
28
|
-
});
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2023 STMicroelectronics and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { ContainerModule } from '@theia/core/shared/inversify';
|
|
18
|
+
import { MetricsFrontendApplicationContribution } from './metrics-frontend-application-contribution';
|
|
19
|
+
import { MeasurementNotificationService, measurementNotificationServicePath } from '../common';
|
|
20
|
+
import { FrontendApplicationContribution, WebSocketConnectionProvider } from '@theia/core/lib/browser';
|
|
21
|
+
|
|
22
|
+
export default new ContainerModule(bind => {
|
|
23
|
+
bind(FrontendApplicationContribution).to(MetricsFrontendApplicationContribution).inSingletonScope();
|
|
24
|
+
bind(MeasurementNotificationService).toDynamicValue(ctx => {
|
|
25
|
+
const connection = ctx.container.get(WebSocketConnectionProvider);
|
|
26
|
+
return connection.createProxy<MeasurementNotificationService>(measurementNotificationServicePath);
|
|
27
|
+
});
|
|
28
|
+
});
|
package/src/common/index.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2023 STMicroelectronics and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
export * from './measurement-notification-service';
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2023 STMicroelectronics and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
export * from './measurement-notification-service';
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2023 STMicroelectronics and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import { MeasurementResult } from '@theia/core';
|
|
18
|
-
|
|
19
|
-
export const measurementNotificationServicePath = '/services/measurement-notification';
|
|
20
|
-
|
|
21
|
-
export const MeasurementNotificationService = Symbol('MeasurementNotificationService');
|
|
22
|
-
export interface MeasurementNotificationService {
|
|
23
|
-
/**
|
|
24
|
-
* Notify the backend when a fronted stopwatch provides a new measurement.
|
|
25
|
-
* @param frontendId The unique id associated with the frontend that sends the notification
|
|
26
|
-
* @param result The new measurement result
|
|
27
|
-
*/
|
|
28
|
-
onFrontendMeasurement(frontendId: string, result: MeasurementResult): void;
|
|
29
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2023 STMicroelectronics and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { MeasurementResult } from '@theia/core';
|
|
18
|
+
|
|
19
|
+
export const measurementNotificationServicePath = '/services/measurement-notification';
|
|
20
|
+
|
|
21
|
+
export const MeasurementNotificationService = Symbol('MeasurementNotificationService');
|
|
22
|
+
export interface MeasurementNotificationService {
|
|
23
|
+
/**
|
|
24
|
+
* Notify the backend when a fronted stopwatch provides a new measurement.
|
|
25
|
+
* @param frontendId The unique id associated with the frontend that sends the notification
|
|
26
|
+
* @param result The new measurement result
|
|
27
|
+
*/
|
|
28
|
+
onFrontendMeasurement(frontendId: string, result: MeasurementResult): void;
|
|
29
|
+
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2023 STMicroelectronics and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import { ContainerModule } from '@theia/core/shared/inversify';
|
|
18
|
-
import { MetricsElectronTokenValidator } from './electron-token-validator';
|
|
19
|
-
import { ElectronTokenValidator } from '@theia/core/lib/electron-node/token/electron-token-validator';
|
|
20
|
-
|
|
21
|
-
export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
22
|
-
bind(MetricsElectronTokenValidator).toSelf().inSingletonScope();
|
|
23
|
-
rebind(ElectronTokenValidator).to(MetricsElectronTokenValidator);
|
|
24
|
-
});
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2023 STMicroelectronics and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { ContainerModule } from '@theia/core/shared/inversify';
|
|
18
|
+
import { MetricsElectronTokenValidator } from './electron-token-validator';
|
|
19
|
+
import { ElectronTokenValidator } from '@theia/core/lib/electron-node/token/electron-token-validator';
|
|
20
|
+
|
|
21
|
+
export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
22
|
+
bind(MetricsElectronTokenValidator).toSelf().inSingletonScope();
|
|
23
|
+
rebind(ElectronTokenValidator).to(MetricsElectronTokenValidator);
|
|
24
|
+
});
|