@theia/metrics 1.48.1 → 1.48.3
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,55 +1,55 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ExtensionMetricsContribution = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
// *****************************************************************************
|
|
6
|
-
// Copyright (C) 2018 Ericsson and others.
|
|
7
|
-
//
|
|
8
|
-
// This program and the accompanying materials are made available under the
|
|
9
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
10
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
11
|
-
//
|
|
12
|
-
// This Source Code may also be made available under the following Secondary
|
|
13
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
14
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
15
|
-
// with the GNU Classpath Exception which is available at
|
|
16
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
17
|
-
//
|
|
18
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
19
|
-
// *****************************************************************************
|
|
20
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
-
const application_package_1 = require("@theia/core/shared/@theia/application-package");
|
|
22
|
-
const prometheus_1 = require("./prometheus");
|
|
23
|
-
const metricsName = 'theia_extension_version';
|
|
24
|
-
let ExtensionMetricsContribution = class ExtensionMetricsContribution {
|
|
25
|
-
constructor() {
|
|
26
|
-
this.metrics = '';
|
|
27
|
-
}
|
|
28
|
-
getMetrics() {
|
|
29
|
-
return this.metrics;
|
|
30
|
-
}
|
|
31
|
-
startCollecting() {
|
|
32
|
-
let latestMetrics = '';
|
|
33
|
-
const installedExtensions = this.applicationPackage.extensionPackages;
|
|
34
|
-
latestMetrics += `# HELP ${metricsName} Theia extension version info.\n`;
|
|
35
|
-
latestMetrics += `# TYPE ${metricsName} gauge\n`;
|
|
36
|
-
installedExtensions.forEach(extensionInfo => {
|
|
37
|
-
let extensionName = extensionInfo.name;
|
|
38
|
-
if (!prometheus_1.PROMETHEUS_REGEXP.test(extensionName)) {
|
|
39
|
-
extensionName = (0, prometheus_1.toPrometheusValidName)(extensionName);
|
|
40
|
-
}
|
|
41
|
-
const metricsValue = metricsName + `{extension="${extensionName}",version="${extensionInfo.version}"} 1`;
|
|
42
|
-
latestMetrics += metricsValue + '\n';
|
|
43
|
-
});
|
|
44
|
-
this.metrics = latestMetrics;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
(0, tslib_1.__decorate)([
|
|
48
|
-
(0, inversify_1.inject)(application_package_1.ApplicationPackage),
|
|
49
|
-
(0, tslib_1.__metadata)("design:type", application_package_1.ApplicationPackage)
|
|
50
|
-
], ExtensionMetricsContribution.prototype, "applicationPackage", void 0);
|
|
51
|
-
ExtensionMetricsContribution = (0, tslib_1.__decorate)([
|
|
52
|
-
(0, inversify_1.injectable)()
|
|
53
|
-
], ExtensionMetricsContribution);
|
|
54
|
-
exports.ExtensionMetricsContribution = ExtensionMetricsContribution;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExtensionMetricsContribution = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// *****************************************************************************
|
|
6
|
+
// Copyright (C) 2018 Ericsson and others.
|
|
7
|
+
//
|
|
8
|
+
// This program and the accompanying materials are made available under the
|
|
9
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
10
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
11
|
+
//
|
|
12
|
+
// This Source Code may also be made available under the following Secondary
|
|
13
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
14
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
15
|
+
// with the GNU Classpath Exception which is available at
|
|
16
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
17
|
+
//
|
|
18
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
19
|
+
// *****************************************************************************
|
|
20
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
+
const application_package_1 = require("@theia/core/shared/@theia/application-package");
|
|
22
|
+
const prometheus_1 = require("./prometheus");
|
|
23
|
+
const metricsName = 'theia_extension_version';
|
|
24
|
+
let ExtensionMetricsContribution = class ExtensionMetricsContribution {
|
|
25
|
+
constructor() {
|
|
26
|
+
this.metrics = '';
|
|
27
|
+
}
|
|
28
|
+
getMetrics() {
|
|
29
|
+
return this.metrics;
|
|
30
|
+
}
|
|
31
|
+
startCollecting() {
|
|
32
|
+
let latestMetrics = '';
|
|
33
|
+
const installedExtensions = this.applicationPackage.extensionPackages;
|
|
34
|
+
latestMetrics += `# HELP ${metricsName} Theia extension version info.\n`;
|
|
35
|
+
latestMetrics += `# TYPE ${metricsName} gauge\n`;
|
|
36
|
+
installedExtensions.forEach(extensionInfo => {
|
|
37
|
+
let extensionName = extensionInfo.name;
|
|
38
|
+
if (!prometheus_1.PROMETHEUS_REGEXP.test(extensionName)) {
|
|
39
|
+
extensionName = (0, prometheus_1.toPrometheusValidName)(extensionName);
|
|
40
|
+
}
|
|
41
|
+
const metricsValue = metricsName + `{extension="${extensionName}",version="${extensionInfo.version}"} 1`;
|
|
42
|
+
latestMetrics += metricsValue + '\n';
|
|
43
|
+
});
|
|
44
|
+
this.metrics = latestMetrics;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
(0, tslib_1.__decorate)([
|
|
48
|
+
(0, inversify_1.inject)(application_package_1.ApplicationPackage),
|
|
49
|
+
(0, tslib_1.__metadata)("design:type", application_package_1.ApplicationPackage)
|
|
50
|
+
], ExtensionMetricsContribution.prototype, "applicationPackage", void 0);
|
|
51
|
+
ExtensionMetricsContribution = (0, tslib_1.__decorate)([
|
|
52
|
+
(0, inversify_1.injectable)()
|
|
53
|
+
], ExtensionMetricsContribution);
|
|
54
|
+
exports.ExtensionMetricsContribution = ExtensionMetricsContribution;
|
|
55
55
|
//# sourceMappingURL=extensions-metrics-contribution.js.map
|
package/lib/node/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './metrics-backend-application-contribution';
|
|
2
|
-
export * from './metrics-contribution';
|
|
3
|
-
export * from './node-metrics-contribution';
|
|
4
|
-
export * from './extensions-metrics-contribution';
|
|
5
|
-
export * from './prometheus';
|
|
1
|
+
export * from './metrics-backend-application-contribution';
|
|
2
|
+
export * from './metrics-contribution';
|
|
3
|
+
export * from './node-metrics-contribution';
|
|
4
|
+
export * from './extensions-metrics-contribution';
|
|
5
|
+
export * from './prometheus';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/node/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
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 tslib_1 = require("tslib");
|
|
19
|
-
(0, tslib_1.__exportStar)(require("./metrics-backend-application-contribution"), exports);
|
|
20
|
-
(0, tslib_1.__exportStar)(require("./metrics-contribution"), exports);
|
|
21
|
-
(0, tslib_1.__exportStar)(require("./node-metrics-contribution"), exports);
|
|
22
|
-
(0, tslib_1.__exportStar)(require("./extensions-metrics-contribution"), exports);
|
|
23
|
-
(0, tslib_1.__exportStar)(require("./prometheus"), exports);
|
|
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 tslib_1 = require("tslib");
|
|
19
|
+
(0, tslib_1.__exportStar)(require("./metrics-backend-application-contribution"), exports);
|
|
20
|
+
(0, tslib_1.__exportStar)(require("./metrics-contribution"), exports);
|
|
21
|
+
(0, tslib_1.__exportStar)(require("./node-metrics-contribution"), exports);
|
|
22
|
+
(0, tslib_1.__exportStar)(require("./extensions-metrics-contribution"), exports);
|
|
23
|
+
(0, tslib_1.__exportStar)(require("./prometheus"), exports);
|
|
24
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { MetricsContribution } from './metrics-contribution';
|
|
2
|
-
import { MeasurementResult, Stopwatch } from '@theia/core';
|
|
3
|
-
import { MeasurementNotificationService } from '../common';
|
|
4
|
-
import { LogLevelCliContribution } from '@theia/core/lib/node/logger-cli-contribution';
|
|
5
|
-
export declare class MeasurementMetricsBackendContribution implements MetricsContribution, MeasurementNotificationService {
|
|
6
|
-
protected backendStopwatch: Stopwatch;
|
|
7
|
-
protected logLevelCli: LogLevelCliContribution;
|
|
8
|
-
protected metrics: string;
|
|
9
|
-
protected frontendCounters: Map<string, string>;
|
|
10
|
-
startCollecting(): void;
|
|
11
|
-
getMetrics(): string;
|
|
12
|
-
protected appendMetricsValue(id: string, result: MeasurementResult): void;
|
|
13
|
-
protected onBackendMeasurement(result: MeasurementResult): void;
|
|
14
|
-
protected createFrontendCounterId(frontendId: string): string;
|
|
15
|
-
protected toCounterId(frontendId: string): string;
|
|
16
|
-
onFrontendMeasurement(frontendId: string, result: MeasurementResult): void;
|
|
17
|
-
}
|
|
1
|
+
import { MetricsContribution } from './metrics-contribution';
|
|
2
|
+
import { MeasurementResult, Stopwatch } from '@theia/core';
|
|
3
|
+
import { MeasurementNotificationService } from '../common';
|
|
4
|
+
import { LogLevelCliContribution } from '@theia/core/lib/node/logger-cli-contribution';
|
|
5
|
+
export declare class MeasurementMetricsBackendContribution implements MetricsContribution, MeasurementNotificationService {
|
|
6
|
+
protected backendStopwatch: Stopwatch;
|
|
7
|
+
protected logLevelCli: LogLevelCliContribution;
|
|
8
|
+
protected metrics: string;
|
|
9
|
+
protected frontendCounters: Map<string, string>;
|
|
10
|
+
startCollecting(): void;
|
|
11
|
+
getMetrics(): string;
|
|
12
|
+
protected appendMetricsValue(id: string, result: MeasurementResult): void;
|
|
13
|
+
protected onBackendMeasurement(result: MeasurementResult): void;
|
|
14
|
+
protected createFrontendCounterId(frontendId: string): string;
|
|
15
|
+
protected toCounterId(frontendId: string): string;
|
|
16
|
+
onFrontendMeasurement(frontendId: string, result: MeasurementResult): void;
|
|
17
|
+
}
|
|
18
18
|
//# sourceMappingURL=measurement-metrics-contribution.d.ts.map
|
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MeasurementMetricsBackendContribution = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
// *****************************************************************************
|
|
6
|
-
// Copyright (C) 2023 STMicroelectronics and others.
|
|
7
|
-
//
|
|
8
|
-
// This program and the accompanying materials are made available under the
|
|
9
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
10
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
11
|
-
//
|
|
12
|
-
// This Source Code may also be made available under the following Secondary
|
|
13
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
14
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
15
|
-
// with the GNU Classpath Exception which is available at
|
|
16
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
17
|
-
//
|
|
18
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
19
|
-
// *****************************************************************************
|
|
20
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
-
const core_1 = require("@theia/core");
|
|
22
|
-
const logger_cli_contribution_1 = require("@theia/core/lib/node/logger-cli-contribution");
|
|
23
|
-
const backendId = 'backend';
|
|
24
|
-
const metricsName = 'theia_measurements';
|
|
25
|
-
let MeasurementMetricsBackendContribution = class MeasurementMetricsBackendContribution {
|
|
26
|
-
constructor() {
|
|
27
|
-
this.metrics = '';
|
|
28
|
-
this.frontendCounters = new Map();
|
|
29
|
-
}
|
|
30
|
-
startCollecting() {
|
|
31
|
-
if (this.logLevelCli.defaultLogLevel !== core_1.LogLevel.DEBUG) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
this.metrics += `# HELP ${metricsName} Theia stopwatch measurement results.\n`;
|
|
35
|
-
this.metrics += `# TYPE ${metricsName} gauge\n`;
|
|
36
|
-
this.backendStopwatch.storedMeasurements.forEach(result => this.onBackendMeasurement(result));
|
|
37
|
-
this.backendStopwatch.onDidAddMeasurementResult(result => this.onBackendMeasurement(result));
|
|
38
|
-
}
|
|
39
|
-
getMetrics() {
|
|
40
|
-
return this.metrics;
|
|
41
|
-
}
|
|
42
|
-
appendMetricsValue(id, result) {
|
|
43
|
-
const { name, elapsed, startTime, owner } = result;
|
|
44
|
-
const labels = `id="${id}", name="${name}", startTime="${startTime}", owner="${owner}"`;
|
|
45
|
-
const metricsValue = `${metricsName}{${labels}} ${elapsed}`;
|
|
46
|
-
this.metrics += (metricsValue + '\n');
|
|
47
|
-
}
|
|
48
|
-
onBackendMeasurement(result) {
|
|
49
|
-
this.appendMetricsValue(backendId, result);
|
|
50
|
-
}
|
|
51
|
-
createFrontendCounterId(frontendId) {
|
|
52
|
-
const counterId = `frontend-${this.frontendCounters.size + 1}`;
|
|
53
|
-
this.frontendCounters.set(frontendId, counterId);
|
|
54
|
-
return counterId;
|
|
55
|
-
}
|
|
56
|
-
toCounterId(frontendId) {
|
|
57
|
-
var _a;
|
|
58
|
-
return (_a = this.frontendCounters.get(frontendId)) !== null && _a !== void 0 ? _a : this.createFrontendCounterId(frontendId);
|
|
59
|
-
}
|
|
60
|
-
onFrontendMeasurement(frontendId, result) {
|
|
61
|
-
this.appendMetricsValue(this.toCounterId(frontendId), result);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
(0, tslib_1.__decorate)([
|
|
65
|
-
(0, inversify_1.inject)(core_1.Stopwatch),
|
|
66
|
-
(0, tslib_1.__metadata)("design:type", core_1.Stopwatch)
|
|
67
|
-
], MeasurementMetricsBackendContribution.prototype, "backendStopwatch", void 0);
|
|
68
|
-
(0, tslib_1.__decorate)([
|
|
69
|
-
(0, inversify_1.inject)(logger_cli_contribution_1.LogLevelCliContribution),
|
|
70
|
-
(0, tslib_1.__metadata)("design:type", logger_cli_contribution_1.LogLevelCliContribution)
|
|
71
|
-
], MeasurementMetricsBackendContribution.prototype, "logLevelCli", void 0);
|
|
72
|
-
MeasurementMetricsBackendContribution = (0, tslib_1.__decorate)([
|
|
73
|
-
(0, inversify_1.injectable)()
|
|
74
|
-
], MeasurementMetricsBackendContribution);
|
|
75
|
-
exports.MeasurementMetricsBackendContribution = MeasurementMetricsBackendContribution;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MeasurementMetricsBackendContribution = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// *****************************************************************************
|
|
6
|
+
// Copyright (C) 2023 STMicroelectronics and others.
|
|
7
|
+
//
|
|
8
|
+
// This program and the accompanying materials are made available under the
|
|
9
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
10
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
11
|
+
//
|
|
12
|
+
// This Source Code may also be made available under the following Secondary
|
|
13
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
14
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
15
|
+
// with the GNU Classpath Exception which is available at
|
|
16
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
17
|
+
//
|
|
18
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
19
|
+
// *****************************************************************************
|
|
20
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
+
const core_1 = require("@theia/core");
|
|
22
|
+
const logger_cli_contribution_1 = require("@theia/core/lib/node/logger-cli-contribution");
|
|
23
|
+
const backendId = 'backend';
|
|
24
|
+
const metricsName = 'theia_measurements';
|
|
25
|
+
let MeasurementMetricsBackendContribution = class MeasurementMetricsBackendContribution {
|
|
26
|
+
constructor() {
|
|
27
|
+
this.metrics = '';
|
|
28
|
+
this.frontendCounters = new Map();
|
|
29
|
+
}
|
|
30
|
+
startCollecting() {
|
|
31
|
+
if (this.logLevelCli.defaultLogLevel !== core_1.LogLevel.DEBUG) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
this.metrics += `# HELP ${metricsName} Theia stopwatch measurement results.\n`;
|
|
35
|
+
this.metrics += `# TYPE ${metricsName} gauge\n`;
|
|
36
|
+
this.backendStopwatch.storedMeasurements.forEach(result => this.onBackendMeasurement(result));
|
|
37
|
+
this.backendStopwatch.onDidAddMeasurementResult(result => this.onBackendMeasurement(result));
|
|
38
|
+
}
|
|
39
|
+
getMetrics() {
|
|
40
|
+
return this.metrics;
|
|
41
|
+
}
|
|
42
|
+
appendMetricsValue(id, result) {
|
|
43
|
+
const { name, elapsed, startTime, owner } = result;
|
|
44
|
+
const labels = `id="${id}", name="${name}", startTime="${startTime}", owner="${owner}"`;
|
|
45
|
+
const metricsValue = `${metricsName}{${labels}} ${elapsed}`;
|
|
46
|
+
this.metrics += (metricsValue + '\n');
|
|
47
|
+
}
|
|
48
|
+
onBackendMeasurement(result) {
|
|
49
|
+
this.appendMetricsValue(backendId, result);
|
|
50
|
+
}
|
|
51
|
+
createFrontendCounterId(frontendId) {
|
|
52
|
+
const counterId = `frontend-${this.frontendCounters.size + 1}`;
|
|
53
|
+
this.frontendCounters.set(frontendId, counterId);
|
|
54
|
+
return counterId;
|
|
55
|
+
}
|
|
56
|
+
toCounterId(frontendId) {
|
|
57
|
+
var _a;
|
|
58
|
+
return (_a = this.frontendCounters.get(frontendId)) !== null && _a !== void 0 ? _a : this.createFrontendCounterId(frontendId);
|
|
59
|
+
}
|
|
60
|
+
onFrontendMeasurement(frontendId, result) {
|
|
61
|
+
this.appendMetricsValue(this.toCounterId(frontendId), result);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
(0, tslib_1.__decorate)([
|
|
65
|
+
(0, inversify_1.inject)(core_1.Stopwatch),
|
|
66
|
+
(0, tslib_1.__metadata)("design:type", core_1.Stopwatch)
|
|
67
|
+
], MeasurementMetricsBackendContribution.prototype, "backendStopwatch", void 0);
|
|
68
|
+
(0, tslib_1.__decorate)([
|
|
69
|
+
(0, inversify_1.inject)(logger_cli_contribution_1.LogLevelCliContribution),
|
|
70
|
+
(0, tslib_1.__metadata)("design:type", logger_cli_contribution_1.LogLevelCliContribution)
|
|
71
|
+
], MeasurementMetricsBackendContribution.prototype, "logLevelCli", void 0);
|
|
72
|
+
MeasurementMetricsBackendContribution = (0, tslib_1.__decorate)([
|
|
73
|
+
(0, inversify_1.injectable)()
|
|
74
|
+
], MeasurementMetricsBackendContribution);
|
|
75
|
+
exports.MeasurementMetricsBackendContribution = MeasurementMetricsBackendContribution;
|
|
76
76
|
//# sourceMappingURL=measurement-metrics-contribution.js.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
/// <reference types="express" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import * as http from 'http';
|
|
4
|
-
import * as https from 'https';
|
|
5
|
-
import * as express from '@theia/core/shared/express';
|
|
6
|
-
import { ContributionProvider } from '@theia/core/lib/common';
|
|
7
|
-
import { BackendApplicationContribution } from '@theia/core/lib/node';
|
|
8
|
-
import { MetricsContribution } from './metrics-contribution';
|
|
9
|
-
export declare class MetricsBackendApplicationContribution implements BackendApplicationContribution {
|
|
10
|
-
protected readonly metricsProviders: ContributionProvider<MetricsContribution>;
|
|
11
|
-
static ENDPOINT: string;
|
|
12
|
-
constructor(metricsProviders: ContributionProvider<MetricsContribution>);
|
|
13
|
-
configure(app: express.Application): void;
|
|
14
|
-
onStart(server: http.Server | https.Server): void;
|
|
15
|
-
fetchMetricsFromProviders(): string;
|
|
16
|
-
}
|
|
1
|
+
/// <reference types="express" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import * as http from 'http';
|
|
4
|
+
import * as https from 'https';
|
|
5
|
+
import * as express from '@theia/core/shared/express';
|
|
6
|
+
import { ContributionProvider } from '@theia/core/lib/common';
|
|
7
|
+
import { BackendApplicationContribution } from '@theia/core/lib/node';
|
|
8
|
+
import { MetricsContribution } from './metrics-contribution';
|
|
9
|
+
export declare class MetricsBackendApplicationContribution implements BackendApplicationContribution {
|
|
10
|
+
protected readonly metricsProviders: ContributionProvider<MetricsContribution>;
|
|
11
|
+
static ENDPOINT: string;
|
|
12
|
+
constructor(metricsProviders: ContributionProvider<MetricsContribution>);
|
|
13
|
+
configure(app: express.Application): void;
|
|
14
|
+
onStart(server: http.Server | https.Server): void;
|
|
15
|
+
fetchMetricsFromProviders(): string;
|
|
16
|
+
}
|
|
17
17
|
//# sourceMappingURL=metrics-backend-application-contribution.d.ts.map
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2017-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
|
-
var MetricsBackendApplicationContribution_1;
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.MetricsBackendApplicationContribution = void 0;
|
|
20
|
-
const tslib_1 = require("tslib");
|
|
21
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
22
|
-
const common_1 = require("@theia/core/lib/common");
|
|
23
|
-
const metrics_contribution_1 = require("./metrics-contribution");
|
|
24
|
-
let MetricsBackendApplicationContribution = MetricsBackendApplicationContribution_1 = class MetricsBackendApplicationContribution {
|
|
25
|
-
constructor(metricsProviders) {
|
|
26
|
-
this.metricsProviders = metricsProviders;
|
|
27
|
-
}
|
|
28
|
-
configure(app) {
|
|
29
|
-
app.get(MetricsBackendApplicationContribution_1.ENDPOINT, (req, res) => {
|
|
30
|
-
const lastMetrics = this.fetchMetricsFromProviders();
|
|
31
|
-
res.send(lastMetrics);
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
onStart(server) {
|
|
35
|
-
this.metricsProviders.getContributions().forEach(contribution => {
|
|
36
|
-
contribution.startCollecting();
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
fetchMetricsFromProviders() {
|
|
40
|
-
return this.metricsProviders.getContributions().reduce((total, contribution) => total += contribution.getMetrics() + '\n', '');
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
MetricsBackendApplicationContribution.ENDPOINT = '/metrics';
|
|
44
|
-
MetricsBackendApplicationContribution = MetricsBackendApplicationContribution_1 = (0, tslib_1.__decorate)([
|
|
45
|
-
(0, inversify_1.injectable)(),
|
|
46
|
-
(0, tslib_1.__param)(0, (0, inversify_1.inject)(common_1.ContributionProvider)),
|
|
47
|
-
(0, tslib_1.__param)(0, (0, inversify_1.named)(metrics_contribution_1.MetricsContribution)),
|
|
48
|
-
(0, tslib_1.__metadata)("design:paramtypes", [Object])
|
|
49
|
-
], MetricsBackendApplicationContribution);
|
|
50
|
-
exports.MetricsBackendApplicationContribution = MetricsBackendApplicationContribution;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2017-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
|
+
var MetricsBackendApplicationContribution_1;
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.MetricsBackendApplicationContribution = void 0;
|
|
20
|
+
const tslib_1 = require("tslib");
|
|
21
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
22
|
+
const common_1 = require("@theia/core/lib/common");
|
|
23
|
+
const metrics_contribution_1 = require("./metrics-contribution");
|
|
24
|
+
let MetricsBackendApplicationContribution = MetricsBackendApplicationContribution_1 = class MetricsBackendApplicationContribution {
|
|
25
|
+
constructor(metricsProviders) {
|
|
26
|
+
this.metricsProviders = metricsProviders;
|
|
27
|
+
}
|
|
28
|
+
configure(app) {
|
|
29
|
+
app.get(MetricsBackendApplicationContribution_1.ENDPOINT, (req, res) => {
|
|
30
|
+
const lastMetrics = this.fetchMetricsFromProviders();
|
|
31
|
+
res.send(lastMetrics);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
onStart(server) {
|
|
35
|
+
this.metricsProviders.getContributions().forEach(contribution => {
|
|
36
|
+
contribution.startCollecting();
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
fetchMetricsFromProviders() {
|
|
40
|
+
return this.metricsProviders.getContributions().reduce((total, contribution) => total += contribution.getMetrics() + '\n', '');
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
MetricsBackendApplicationContribution.ENDPOINT = '/metrics';
|
|
44
|
+
MetricsBackendApplicationContribution = MetricsBackendApplicationContribution_1 = (0, tslib_1.__decorate)([
|
|
45
|
+
(0, inversify_1.injectable)(),
|
|
46
|
+
(0, tslib_1.__param)(0, (0, inversify_1.inject)(common_1.ContributionProvider)),
|
|
47
|
+
(0, tslib_1.__param)(0, (0, inversify_1.named)(metrics_contribution_1.MetricsContribution)),
|
|
48
|
+
(0, tslib_1.__metadata)("design:paramtypes", [Object])
|
|
49
|
+
], MetricsBackendApplicationContribution);
|
|
50
|
+
exports.MetricsBackendApplicationContribution = MetricsBackendApplicationContribution;
|
|
51
51
|
//# sourceMappingURL=metrics-backend-application-contribution.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContainerModule } from '@theia/core/shared/inversify';
|
|
2
|
-
declare const _default: ContainerModule;
|
|
3
|
-
export default _default;
|
|
1
|
+
import { ContainerModule } from '@theia/core/shared/inversify';
|
|
2
|
+
declare const _default: ContainerModule;
|
|
3
|
+
export default _default;
|
|
4
4
|
//# sourceMappingURL=metrics-backend-module.d.ts.map
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2017-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 inversify_1 = require("@theia/core/shared/inversify");
|
|
19
|
-
const node_1 = require("@theia/core/lib/node");
|
|
20
|
-
const common_1 = require("@theia/core/lib/common");
|
|
21
|
-
const metrics_contribution_1 = require("./metrics-contribution");
|
|
22
|
-
const node_metrics_contribution_1 = require("./node-metrics-contribution");
|
|
23
|
-
const extensions_metrics_contribution_1 = require("./extensions-metrics-contribution");
|
|
24
|
-
const metrics_backend_application_contribution_1 = require("./metrics-backend-application-contribution");
|
|
25
|
-
const common_2 = require("../common");
|
|
26
|
-
const measurement_metrics_contribution_1 = require("./measurement-metrics-contribution");
|
|
27
|
-
exports.default = new inversify_1.ContainerModule(bind => {
|
|
28
|
-
(0, common_1.bindContributionProvider)(bind, metrics_contribution_1.MetricsContribution);
|
|
29
|
-
bind(metrics_contribution_1.MetricsContribution).to(node_metrics_contribution_1.NodeMetricsContribution).inSingletonScope();
|
|
30
|
-
bind(metrics_contribution_1.MetricsContribution).to(extensions_metrics_contribution_1.ExtensionMetricsContribution).inSingletonScope();
|
|
31
|
-
bind(measurement_metrics_contribution_1.MeasurementMetricsBackendContribution).toSelf().inSingletonScope();
|
|
32
|
-
bind(metrics_contribution_1.MetricsContribution).toService(measurement_metrics_contribution_1.MeasurementMetricsBackendContribution);
|
|
33
|
-
bind(common_1.ConnectionHandler).toDynamicValue(ctx => new common_1.RpcConnectionHandler(common_2.measurementNotificationServicePath, () => ctx.container.get(measurement_metrics_contribution_1.MeasurementMetricsBackendContribution)));
|
|
34
|
-
bind(node_1.BackendApplicationContribution).to(metrics_backend_application_contribution_1.MetricsBackendApplicationContribution).inSingletonScope();
|
|
35
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2017-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 inversify_1 = require("@theia/core/shared/inversify");
|
|
19
|
+
const node_1 = require("@theia/core/lib/node");
|
|
20
|
+
const common_1 = require("@theia/core/lib/common");
|
|
21
|
+
const metrics_contribution_1 = require("./metrics-contribution");
|
|
22
|
+
const node_metrics_contribution_1 = require("./node-metrics-contribution");
|
|
23
|
+
const extensions_metrics_contribution_1 = require("./extensions-metrics-contribution");
|
|
24
|
+
const metrics_backend_application_contribution_1 = require("./metrics-backend-application-contribution");
|
|
25
|
+
const common_2 = require("../common");
|
|
26
|
+
const measurement_metrics_contribution_1 = require("./measurement-metrics-contribution");
|
|
27
|
+
exports.default = new inversify_1.ContainerModule(bind => {
|
|
28
|
+
(0, common_1.bindContributionProvider)(bind, metrics_contribution_1.MetricsContribution);
|
|
29
|
+
bind(metrics_contribution_1.MetricsContribution).to(node_metrics_contribution_1.NodeMetricsContribution).inSingletonScope();
|
|
30
|
+
bind(metrics_contribution_1.MetricsContribution).to(extensions_metrics_contribution_1.ExtensionMetricsContribution).inSingletonScope();
|
|
31
|
+
bind(measurement_metrics_contribution_1.MeasurementMetricsBackendContribution).toSelf().inSingletonScope();
|
|
32
|
+
bind(metrics_contribution_1.MetricsContribution).toService(measurement_metrics_contribution_1.MeasurementMetricsBackendContribution);
|
|
33
|
+
bind(common_1.ConnectionHandler).toDynamicValue(ctx => new common_1.RpcConnectionHandler(common_2.measurementNotificationServicePath, () => ctx.container.get(measurement_metrics_contribution_1.MeasurementMetricsBackendContribution)));
|
|
34
|
+
bind(node_1.BackendApplicationContribution).to(metrics_backend_application_contribution_1.MetricsBackendApplicationContribution).inSingletonScope();
|
|
35
|
+
});
|
|
36
36
|
//# sourceMappingURL=metrics-backend-module.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare const MetricsContribution: unique symbol;
|
|
2
|
-
export interface MetricsContribution {
|
|
3
|
-
startCollecting(): void;
|
|
4
|
-
getMetrics(): string;
|
|
5
|
-
}
|
|
1
|
+
export declare const MetricsContribution: unique symbol;
|
|
2
|
+
export interface MetricsContribution {
|
|
3
|
+
startCollecting(): void;
|
|
4
|
+
getMetrics(): string;
|
|
5
|
+
}
|
|
6
6
|
//# sourceMappingURL=metrics-contribution.d.ts.map
|