@theia/metrics 1.45.0 → 1.46.0-next.72

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.
Files changed (41) hide show
  1. package/README.md +30 -30
  2. package/lib/browser/metrics-frontend-application-contribution.d.ts +12 -12
  3. package/lib/browser/metrics-frontend-application-contribution.js +66 -66
  4. package/lib/browser/metrics-frontend-module.d.ts +3 -3
  5. package/lib/browser/metrics-frontend-module.js +28 -28
  6. package/lib/common/index.d.ts +1 -1
  7. package/lib/common/index.js +28 -28
  8. package/lib/common/measurement-notification-service.d.ts +11 -11
  9. package/lib/common/measurement-notification-service.js +20 -20
  10. package/lib/node/extensions-metrics-contribution.d.ts +8 -8
  11. package/lib/node/extensions-metrics-contribution.js +62 -62
  12. package/lib/node/index.d.ts +5 -5
  13. package/lib/node/index.js +32 -32
  14. package/lib/node/measurement-metrics-contribution.d.ts +17 -17
  15. package/lib/node/measurement-metrics-contribution.js +83 -83
  16. package/lib/node/metrics-backend-application-contribution.d.ts +15 -15
  17. package/lib/node/metrics-backend-application-contribution.js +59 -59
  18. package/lib/node/metrics-backend-module.d.ts +3 -3
  19. package/lib/node/metrics-backend-module.js +35 -35
  20. package/lib/node/metrics-contribution.d.ts +5 -5
  21. package/lib/node/metrics-contribution.js +19 -19
  22. package/lib/node/node-metrics-contribution.d.ts +5 -5
  23. package/lib/node/node-metrics-contribution.js +40 -40
  24. package/lib/node/prometheus.d.ts +2 -2
  25. package/lib/node/prometheus.js +27 -27
  26. package/lib/node/prometheus.spec.d.ts +1 -1
  27. package/lib/node/prometheus.spec.js +40 -40
  28. package/package.json +4 -4
  29. package/src/browser/metrics-frontend-application-contribution.ts +51 -51
  30. package/src/browser/metrics-frontend-module.ts +28 -28
  31. package/src/common/index.ts +17 -17
  32. package/src/common/measurement-notification-service.ts +29 -29
  33. package/src/node/extensions-metrics-contribution.ts +51 -51
  34. package/src/node/index.ts +21 -21
  35. package/src/node/measurement-metrics-contribution.ts +75 -75
  36. package/src/node/metrics-backend-application-contribution.ts +50 -50
  37. package/src/node/metrics-backend-module.ts +40 -40
  38. package/src/node/metrics-contribution.ts +20 -20
  39. package/src/node/node-metrics-contribution.ts +33 -33
  40. package/src/node/prometheus.spec.ts +49 -49
  41. package/src/node/prometheus.ts +25 -25
package/lib/node/index.js CHANGED
@@ -1,33 +1,33 @@
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
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
25
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
26
- };
27
- Object.defineProperty(exports, "__esModule", { value: true });
28
- __exportStar(require("./metrics-backend-application-contribution"), exports);
29
- __exportStar(require("./metrics-contribution"), exports);
30
- __exportStar(require("./node-metrics-contribution"), exports);
31
- __exportStar(require("./extensions-metrics-contribution"), exports);
32
- __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
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
25
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ __exportStar(require("./metrics-backend-application-contribution"), exports);
29
+ __exportStar(require("./metrics-contribution"), exports);
30
+ __exportStar(require("./node-metrics-contribution"), exports);
31
+ __exportStar(require("./extensions-metrics-contribution"), exports);
32
+ __exportStar(require("./prometheus"), exports);
33
33
  //# 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,84 +1,84 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.MeasurementMetricsBackendContribution = void 0;
13
- // *****************************************************************************
14
- // Copyright (C) 2023 STMicroelectronics and others.
15
- //
16
- // This program and the accompanying materials are made available under the
17
- // terms of the Eclipse Public License v. 2.0 which is available at
18
- // http://www.eclipse.org/legal/epl-2.0.
19
- //
20
- // This Source Code may also be made available under the following Secondary
21
- // Licenses when the conditions for such availability set forth in the Eclipse
22
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
23
- // with the GNU Classpath Exception which is available at
24
- // https://www.gnu.org/software/classpath/license.html.
25
- //
26
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
27
- // *****************************************************************************
28
- const inversify_1 = require("@theia/core/shared/inversify");
29
- const core_1 = require("@theia/core");
30
- const logger_cli_contribution_1 = require("@theia/core/lib/node/logger-cli-contribution");
31
- const backendId = 'backend';
32
- const metricsName = 'theia_measurements';
33
- let MeasurementMetricsBackendContribution = class MeasurementMetricsBackendContribution {
34
- constructor() {
35
- this.metrics = '';
36
- this.frontendCounters = new Map();
37
- }
38
- startCollecting() {
39
- if (this.logLevelCli.defaultLogLevel !== core_1.LogLevel.DEBUG) {
40
- return;
41
- }
42
- this.metrics += `# HELP ${metricsName} Theia stopwatch measurement results.\n`;
43
- this.metrics += `# TYPE ${metricsName} gauge\n`;
44
- this.backendStopwatch.storedMeasurements.forEach(result => this.onBackendMeasurement(result));
45
- this.backendStopwatch.onDidAddMeasurementResult(result => this.onBackendMeasurement(result));
46
- }
47
- getMetrics() {
48
- return this.metrics;
49
- }
50
- appendMetricsValue(id, result) {
51
- const { name, elapsed, startTime, owner } = result;
52
- const labels = `id="${id}", name="${name}", startTime="${startTime}", owner="${owner}"`;
53
- const metricsValue = `${metricsName}{${labels}} ${elapsed}`;
54
- this.metrics += (metricsValue + '\n');
55
- }
56
- onBackendMeasurement(result) {
57
- this.appendMetricsValue(backendId, result);
58
- }
59
- createFrontendCounterId(frontendId) {
60
- const counterId = `frontend-${this.frontendCounters.size + 1}`;
61
- this.frontendCounters.set(frontendId, counterId);
62
- return counterId;
63
- }
64
- toCounterId(frontendId) {
65
- var _a;
66
- return (_a = this.frontendCounters.get(frontendId)) !== null && _a !== void 0 ? _a : this.createFrontendCounterId(frontendId);
67
- }
68
- onFrontendMeasurement(frontendId, result) {
69
- this.appendMetricsValue(this.toCounterId(frontendId), result);
70
- }
71
- };
72
- __decorate([
73
- (0, inversify_1.inject)(core_1.Stopwatch),
74
- __metadata("design:type", core_1.Stopwatch)
75
- ], MeasurementMetricsBackendContribution.prototype, "backendStopwatch", void 0);
76
- __decorate([
77
- (0, inversify_1.inject)(logger_cli_contribution_1.LogLevelCliContribution),
78
- __metadata("design:type", logger_cli_contribution_1.LogLevelCliContribution)
79
- ], MeasurementMetricsBackendContribution.prototype, "logLevelCli", void 0);
80
- MeasurementMetricsBackendContribution = __decorate([
81
- (0, inversify_1.injectable)()
82
- ], MeasurementMetricsBackendContribution);
83
- exports.MeasurementMetricsBackendContribution = MeasurementMetricsBackendContribution;
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.MeasurementMetricsBackendContribution = void 0;
13
+ // *****************************************************************************
14
+ // Copyright (C) 2023 STMicroelectronics and others.
15
+ //
16
+ // This program and the accompanying materials are made available under the
17
+ // terms of the Eclipse Public License v. 2.0 which is available at
18
+ // http://www.eclipse.org/legal/epl-2.0.
19
+ //
20
+ // This Source Code may also be made available under the following Secondary
21
+ // Licenses when the conditions for such availability set forth in the Eclipse
22
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
23
+ // with the GNU Classpath Exception which is available at
24
+ // https://www.gnu.org/software/classpath/license.html.
25
+ //
26
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
27
+ // *****************************************************************************
28
+ const inversify_1 = require("@theia/core/shared/inversify");
29
+ const core_1 = require("@theia/core");
30
+ const logger_cli_contribution_1 = require("@theia/core/lib/node/logger-cli-contribution");
31
+ const backendId = 'backend';
32
+ const metricsName = 'theia_measurements';
33
+ let MeasurementMetricsBackendContribution = class MeasurementMetricsBackendContribution {
34
+ constructor() {
35
+ this.metrics = '';
36
+ this.frontendCounters = new Map();
37
+ }
38
+ startCollecting() {
39
+ if (this.logLevelCli.defaultLogLevel !== core_1.LogLevel.DEBUG) {
40
+ return;
41
+ }
42
+ this.metrics += `# HELP ${metricsName} Theia stopwatch measurement results.\n`;
43
+ this.metrics += `# TYPE ${metricsName} gauge\n`;
44
+ this.backendStopwatch.storedMeasurements.forEach(result => this.onBackendMeasurement(result));
45
+ this.backendStopwatch.onDidAddMeasurementResult(result => this.onBackendMeasurement(result));
46
+ }
47
+ getMetrics() {
48
+ return this.metrics;
49
+ }
50
+ appendMetricsValue(id, result) {
51
+ const { name, elapsed, startTime, owner } = result;
52
+ const labels = `id="${id}", name="${name}", startTime="${startTime}", owner="${owner}"`;
53
+ const metricsValue = `${metricsName}{${labels}} ${elapsed}`;
54
+ this.metrics += (metricsValue + '\n');
55
+ }
56
+ onBackendMeasurement(result) {
57
+ this.appendMetricsValue(backendId, result);
58
+ }
59
+ createFrontendCounterId(frontendId) {
60
+ const counterId = `frontend-${this.frontendCounters.size + 1}`;
61
+ this.frontendCounters.set(frontendId, counterId);
62
+ return counterId;
63
+ }
64
+ toCounterId(frontendId) {
65
+ var _a;
66
+ return (_a = this.frontendCounters.get(frontendId)) !== null && _a !== void 0 ? _a : this.createFrontendCounterId(frontendId);
67
+ }
68
+ onFrontendMeasurement(frontendId, result) {
69
+ this.appendMetricsValue(this.toCounterId(frontendId), result);
70
+ }
71
+ };
72
+ __decorate([
73
+ (0, inversify_1.inject)(core_1.Stopwatch),
74
+ __metadata("design:type", core_1.Stopwatch)
75
+ ], MeasurementMetricsBackendContribution.prototype, "backendStopwatch", void 0);
76
+ __decorate([
77
+ (0, inversify_1.inject)(logger_cli_contribution_1.LogLevelCliContribution),
78
+ __metadata("design:type", logger_cli_contribution_1.LogLevelCliContribution)
79
+ ], MeasurementMetricsBackendContribution.prototype, "logLevelCli", void 0);
80
+ MeasurementMetricsBackendContribution = __decorate([
81
+ (0, inversify_1.injectable)()
82
+ ], MeasurementMetricsBackendContribution);
83
+ exports.MeasurementMetricsBackendContribution = MeasurementMetricsBackendContribution;
84
84
  //# sourceMappingURL=measurement-metrics-contribution.js.map
@@ -1,16 +1,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
- constructor(metricsProviders: ContributionProvider<MetricsContribution>);
12
- configure(app: express.Application): void;
13
- onStart(server: http.Server | https.Server): void;
14
- fetchMetricsFromProviders(): string;
15
- }
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
+ constructor(metricsProviders: ContributionProvider<MetricsContribution>);
12
+ configure(app: express.Application): void;
13
+ onStart(server: http.Server | https.Server): void;
14
+ fetchMetricsFromProviders(): string;
15
+ }
16
16
  //# sourceMappingURL=metrics-backend-application-contribution.d.ts.map
@@ -1,60 +1,60 @@
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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
- return c > 3 && r && Object.defineProperty(target, key, r), r;
22
- };
23
- var __metadata = (this && this.__metadata) || function (k, v) {
24
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
- };
26
- var __param = (this && this.__param) || function (paramIndex, decorator) {
27
- return function (target, key) { decorator(target, key, paramIndex); }
28
- };
29
- Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.MetricsBackendApplicationContribution = void 0;
31
- const inversify_1 = require("@theia/core/shared/inversify");
32
- const common_1 = require("@theia/core/lib/common");
33
- const metrics_contribution_1 = require("./metrics-contribution");
34
- let MetricsBackendApplicationContribution = class MetricsBackendApplicationContribution {
35
- constructor(metricsProviders) {
36
- this.metricsProviders = metricsProviders;
37
- }
38
- configure(app) {
39
- app.get('/metrics', (req, res) => {
40
- const lastMetrics = this.fetchMetricsFromProviders();
41
- res.send(lastMetrics);
42
- });
43
- }
44
- onStart(server) {
45
- this.metricsProviders.getContributions().forEach(contribution => {
46
- contribution.startCollecting();
47
- });
48
- }
49
- fetchMetricsFromProviders() {
50
- return this.metricsProviders.getContributions().reduce((total, contribution) => total += contribution.getMetrics() + '\n', '');
51
- }
52
- };
53
- MetricsBackendApplicationContribution = __decorate([
54
- (0, inversify_1.injectable)(),
55
- __param(0, (0, inversify_1.inject)(common_1.ContributionProvider)),
56
- __param(0, (0, inversify_1.named)(metrics_contribution_1.MetricsContribution)),
57
- __metadata("design:paramtypes", [Object])
58
- ], MetricsBackendApplicationContribution);
59
- 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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
27
+ return function (target, key) { decorator(target, key, paramIndex); }
28
+ };
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ exports.MetricsBackendApplicationContribution = void 0;
31
+ const inversify_1 = require("@theia/core/shared/inversify");
32
+ const common_1 = require("@theia/core/lib/common");
33
+ const metrics_contribution_1 = require("./metrics-contribution");
34
+ let MetricsBackendApplicationContribution = class MetricsBackendApplicationContribution {
35
+ constructor(metricsProviders) {
36
+ this.metricsProviders = metricsProviders;
37
+ }
38
+ configure(app) {
39
+ app.get('/metrics', (req, res) => {
40
+ const lastMetrics = this.fetchMetricsFromProviders();
41
+ res.send(lastMetrics);
42
+ });
43
+ }
44
+ onStart(server) {
45
+ this.metricsProviders.getContributions().forEach(contribution => {
46
+ contribution.startCollecting();
47
+ });
48
+ }
49
+ fetchMetricsFromProviders() {
50
+ return this.metricsProviders.getContributions().reduce((total, contribution) => total += contribution.getMetrics() + '\n', '');
51
+ }
52
+ };
53
+ MetricsBackendApplicationContribution = __decorate([
54
+ (0, inversify_1.injectable)(),
55
+ __param(0, (0, inversify_1.inject)(common_1.ContributionProvider)),
56
+ __param(0, (0, inversify_1.named)(metrics_contribution_1.MetricsContribution)),
57
+ __metadata("design:paramtypes", [Object])
58
+ ], MetricsBackendApplicationContribution);
59
+ exports.MetricsBackendApplicationContribution = MetricsBackendApplicationContribution;
60
60
  //# 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
@@ -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