@theia/plugin-metrics 1.34.2 → 1.34.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/LICENSE +641 -641
- package/README.md +63 -63
- package/lib/browser/plugin-metrics-creator.d.ts +67 -67
- package/lib/browser/plugin-metrics-creator.js +185 -185
- package/lib/browser/plugin-metrics-frontend-module.d.ts +3 -3
- package/lib/browser/plugin-metrics-frontend-module.js +36 -36
- package/lib/browser/plugin-metrics-languages-main.d.ts +58 -58
- package/lib/browser/plugin-metrics-languages-main.js +211 -211
- package/lib/browser/plugin-metrics-output-registry.d.ts +7 -7
- package/lib/browser/plugin-metrics-output-registry.js +48 -48
- package/lib/browser/plugin-metrics-resolver.d.ts +17 -17
- package/lib/browser/plugin-metrics-resolver.js +69 -69
- package/lib/common/metrics-protocol.d.ts +10 -10
- package/lib/common/metrics-protocol.js +24 -24
- package/lib/common/plugin-metrics-types.d.ts +27 -27
- package/lib/common/plugin-metrics-types.js +56 -56
- package/lib/node/metric-output/plugin-metrics-time-count.d.ts +5 -5
- package/lib/node/metric-output/plugin-metrics-time-count.js +43 -43
- package/lib/node/metric-output/plugin-metrics-time-sum.d.ts +5 -5
- package/lib/node/metric-output/plugin-metrics-time-sum.js +41 -41
- package/lib/node/metric-string-generator.d.ts +6 -6
- package/lib/node/metric-string-generator.js +78 -78
- package/lib/node/metrics-contributor.d.ts +6 -6
- package/lib/node/metrics-contributor.js +76 -76
- package/lib/node/metrics-contributor.spec.d.ts +1 -1
- package/lib/node/metrics-contributor.spec.js +203 -203
- package/lib/node/plugin-metrics-backend-module.d.ts +3 -3
- package/lib/node/plugin-metrics-backend-module.js +47 -47
- package/lib/node/plugin-metrics-impl.d.ts +10 -10
- package/lib/node/plugin-metrics-impl.js +45 -45
- package/lib/node/plugin-metrics.d.ts +10 -10
- package/lib/node/plugin-metrics.js +54 -54
- package/package.json +7 -7
- package/src/browser/plugin-metrics-creator.ts +189 -189
- package/src/browser/plugin-metrics-frontend-module.ts +38 -38
- package/src/browser/plugin-metrics-languages-main.ts +325 -325
- package/src/browser/plugin-metrics-output-registry.ts +37 -37
- package/src/browser/plugin-metrics-resolver.ts +57 -57
- package/src/common/metrics-protocol.ts +27 -27
- package/src/common/plugin-metrics-types.ts +80 -80
- package/src/node/metric-output/plugin-metrics-time-count.ts +36 -36
- package/src/node/metric-output/plugin-metrics-time-sum.ts +35 -35
- package/src/node/metric-string-generator.ts +70 -70
- package/src/node/metrics-contributor.spec.ts +234 -234
- package/src/node/metrics-contributor.ts +70 -70
- package/src/node/plugin-metrics-backend-module.ts +49 -49
- package/src/node/plugin-metrics-impl.ts +38 -38
- package/src/node/plugin-metrics.ts +44 -44
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2019 Red Hat, Inc. 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 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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.PluginMetricsResolver = void 0;
|
|
28
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
29
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
30
|
-
const plugin_metrics_creator_1 = require("./plugin-metrics-creator");
|
|
31
|
-
const plugin_metrics_types_1 = require("../common/plugin-metrics-types");
|
|
32
|
-
/**
|
|
33
|
-
* This class helps resolve language server requests into successes or failures
|
|
34
|
-
* and sends the data to the metricsExtractor
|
|
35
|
-
*/
|
|
36
|
-
let PluginMetricsResolver = class PluginMetricsResolver {
|
|
37
|
-
/**
|
|
38
|
-
* Resolve a request for pluginID and create a metric based on whether or not
|
|
39
|
-
* the language server errored.
|
|
40
|
-
*
|
|
41
|
-
* @param pluginID the ID of the plugin that made the request
|
|
42
|
-
* @param method the method that was request
|
|
43
|
-
* @param request the result of the language server request
|
|
44
|
-
*/
|
|
45
|
-
async resolveRequest(pluginID, method, request) {
|
|
46
|
-
const currentTime = performance.now();
|
|
47
|
-
try {
|
|
48
|
-
const value = await request;
|
|
49
|
-
this.createAndSetMetric(pluginID, method, performance.now() - currentTime, true);
|
|
50
|
-
return value;
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
this.createAndSetMetric(pluginID, method, performance.now() - currentTime, false);
|
|
54
|
-
return Promise.reject(error);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
createAndSetMetric(pluginID, method, time, successful) {
|
|
58
|
-
const createdSuccessMetric = (0, plugin_metrics_types_1.createRequestData)(pluginID, method, time);
|
|
59
|
-
this.metricsCreator.createMetric(createdSuccessMetric, successful);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
__decorate([
|
|
63
|
-
(0, inversify_1.inject)(plugin_metrics_creator_1.PluginMetricsCreator),
|
|
64
|
-
__metadata("design:type", plugin_metrics_creator_1.PluginMetricsCreator)
|
|
65
|
-
], PluginMetricsResolver.prototype, "metricsCreator", void 0);
|
|
66
|
-
PluginMetricsResolver = __decorate([
|
|
67
|
-
(0, inversify_1.injectable)()
|
|
68
|
-
], PluginMetricsResolver);
|
|
69
|
-
exports.PluginMetricsResolver = PluginMetricsResolver;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2019 Red Hat, Inc. 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 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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.PluginMetricsResolver = void 0;
|
|
28
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
29
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
30
|
+
const plugin_metrics_creator_1 = require("./plugin-metrics-creator");
|
|
31
|
+
const plugin_metrics_types_1 = require("../common/plugin-metrics-types");
|
|
32
|
+
/**
|
|
33
|
+
* This class helps resolve language server requests into successes or failures
|
|
34
|
+
* and sends the data to the metricsExtractor
|
|
35
|
+
*/
|
|
36
|
+
let PluginMetricsResolver = class PluginMetricsResolver {
|
|
37
|
+
/**
|
|
38
|
+
* Resolve a request for pluginID and create a metric based on whether or not
|
|
39
|
+
* the language server errored.
|
|
40
|
+
*
|
|
41
|
+
* @param pluginID the ID of the plugin that made the request
|
|
42
|
+
* @param method the method that was request
|
|
43
|
+
* @param request the result of the language server request
|
|
44
|
+
*/
|
|
45
|
+
async resolveRequest(pluginID, method, request) {
|
|
46
|
+
const currentTime = performance.now();
|
|
47
|
+
try {
|
|
48
|
+
const value = await request;
|
|
49
|
+
this.createAndSetMetric(pluginID, method, performance.now() - currentTime, true);
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
this.createAndSetMetric(pluginID, method, performance.now() - currentTime, false);
|
|
54
|
+
return Promise.reject(error);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
createAndSetMetric(pluginID, method, time, successful) {
|
|
58
|
+
const createdSuccessMetric = (0, plugin_metrics_types_1.createRequestData)(pluginID, method, time);
|
|
59
|
+
this.metricsCreator.createMetric(createdSuccessMetric, successful);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, inversify_1.inject)(plugin_metrics_creator_1.PluginMetricsCreator),
|
|
64
|
+
__metadata("design:type", plugin_metrics_creator_1.PluginMetricsCreator)
|
|
65
|
+
], PluginMetricsResolver.prototype, "metricsCreator", void 0);
|
|
66
|
+
PluginMetricsResolver = __decorate([
|
|
67
|
+
(0, inversify_1.injectable)()
|
|
68
|
+
], PluginMetricsResolver);
|
|
69
|
+
exports.PluginMetricsResolver = PluginMetricsResolver;
|
|
70
70
|
//# sourceMappingURL=plugin-metrics-resolver.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The JSON-RPC interface for plugin metrics
|
|
3
|
-
*/
|
|
4
|
-
export declare const metricsJsonRpcPath = "/services/plugin-ext/metrics";
|
|
5
|
-
export declare const PluginMetrics: unique symbol;
|
|
6
|
-
export interface PluginMetrics {
|
|
7
|
-
setMetrics(metrics: string): void;
|
|
8
|
-
getMetrics(): string;
|
|
9
|
-
}
|
|
10
|
-
export declare const METRICS_TIMEOUT = 10000;
|
|
1
|
+
/**
|
|
2
|
+
* The JSON-RPC interface for plugin metrics
|
|
3
|
+
*/
|
|
4
|
+
export declare const metricsJsonRpcPath = "/services/plugin-ext/metrics";
|
|
5
|
+
export declare const PluginMetrics: unique symbol;
|
|
6
|
+
export interface PluginMetrics {
|
|
7
|
+
setMetrics(metrics: string): void;
|
|
8
|
+
getMetrics(): string;
|
|
9
|
+
}
|
|
10
|
+
export declare const METRICS_TIMEOUT = 10000;
|
|
11
11
|
//# sourceMappingURL=metrics-protocol.d.ts.map
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2019 Red Hat, Inc. 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 WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.METRICS_TIMEOUT = exports.PluginMetrics = exports.metricsJsonRpcPath = void 0;
|
|
19
|
-
/**
|
|
20
|
-
* The JSON-RPC interface for plugin metrics
|
|
21
|
-
*/
|
|
22
|
-
exports.metricsJsonRpcPath = '/services/plugin-ext/metrics';
|
|
23
|
-
exports.PluginMetrics = Symbol('PluginMetrics');
|
|
24
|
-
exports.METRICS_TIMEOUT = 10000;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2019 Red Hat, Inc. 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 WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.METRICS_TIMEOUT = exports.PluginMetrics = exports.metricsJsonRpcPath = void 0;
|
|
19
|
+
/**
|
|
20
|
+
* The JSON-RPC interface for plugin metrics
|
|
21
|
+
*/
|
|
22
|
+
exports.metricsJsonRpcPath = '/services/plugin-ext/metrics';
|
|
23
|
+
exports.PluginMetrics = Symbol('PluginMetrics');
|
|
24
|
+
exports.METRICS_TIMEOUT = 10000;
|
|
25
25
|
//# sourceMappingURL=metrics-protocol.js.map
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
export interface MetricsMap {
|
|
2
|
-
[extensionID: string]: MethodToAnalytics;
|
|
3
|
-
}
|
|
4
|
-
export interface MethodToAnalytics {
|
|
5
|
-
[methodID: string]: AnalyticsFromRequests;
|
|
6
|
-
}
|
|
7
|
-
export interface AnalyticsFromRequests {
|
|
8
|
-
totalRequests: number;
|
|
9
|
-
successfulResponses: number;
|
|
10
|
-
sumOfTimeForSuccess: number;
|
|
11
|
-
sumOfTimeForFailure: number;
|
|
12
|
-
}
|
|
13
|
-
export interface DataFromRequest {
|
|
14
|
-
pluginID: string;
|
|
15
|
-
errorContentsOrMethod: string;
|
|
16
|
-
timeTaken: number;
|
|
17
|
-
}
|
|
18
|
-
export interface MetricOutput {
|
|
19
|
-
header: string;
|
|
20
|
-
createMetricOutput(pluginID: string, method: string, requestAnalytics: AnalyticsFromRequests): string;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Helper functions for creating an object that corresponds to the DataFromRequest interface
|
|
24
|
-
*/
|
|
25
|
-
export declare function createRequestData(pluginID: string, errorContentsOrMethod: string, timeTaken: number): DataFromRequest;
|
|
26
|
-
export declare function createDefaultRequestData(pluginID: string, errorContentsOrMethod: string): DataFromRequest;
|
|
27
|
-
export declare function createDefaultAnalytics(timeTaken: number, isRequestSuccessful: boolean): AnalyticsFromRequests;
|
|
1
|
+
export interface MetricsMap {
|
|
2
|
+
[extensionID: string]: MethodToAnalytics;
|
|
3
|
+
}
|
|
4
|
+
export interface MethodToAnalytics {
|
|
5
|
+
[methodID: string]: AnalyticsFromRequests;
|
|
6
|
+
}
|
|
7
|
+
export interface AnalyticsFromRequests {
|
|
8
|
+
totalRequests: number;
|
|
9
|
+
successfulResponses: number;
|
|
10
|
+
sumOfTimeForSuccess: number;
|
|
11
|
+
sumOfTimeForFailure: number;
|
|
12
|
+
}
|
|
13
|
+
export interface DataFromRequest {
|
|
14
|
+
pluginID: string;
|
|
15
|
+
errorContentsOrMethod: string;
|
|
16
|
+
timeTaken: number;
|
|
17
|
+
}
|
|
18
|
+
export interface MetricOutput {
|
|
19
|
+
header: string;
|
|
20
|
+
createMetricOutput(pluginID: string, method: string, requestAnalytics: AnalyticsFromRequests): string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Helper functions for creating an object that corresponds to the DataFromRequest interface
|
|
24
|
+
*/
|
|
25
|
+
export declare function createRequestData(pluginID: string, errorContentsOrMethod: string, timeTaken: number): DataFromRequest;
|
|
26
|
+
export declare function createDefaultRequestData(pluginID: string, errorContentsOrMethod: string): DataFromRequest;
|
|
27
|
+
export declare function createDefaultAnalytics(timeTaken: number, isRequestSuccessful: boolean): AnalyticsFromRequests;
|
|
28
28
|
//# sourceMappingURL=plugin-metrics-types.d.ts.map
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2019 Red Hat, Inc. 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 WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.createDefaultAnalytics = exports.createDefaultRequestData = exports.createRequestData = void 0;
|
|
19
|
-
/**
|
|
20
|
-
* Helper functions for creating an object that corresponds to the DataFromRequest interface
|
|
21
|
-
*/
|
|
22
|
-
function createRequestData(pluginID, errorContentsOrMethod, timeTaken) {
|
|
23
|
-
return {
|
|
24
|
-
pluginID,
|
|
25
|
-
errorContentsOrMethod,
|
|
26
|
-
timeTaken
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
exports.createRequestData = createRequestData;
|
|
30
|
-
function createDefaultRequestData(pluginID, errorContentsOrMethod) {
|
|
31
|
-
return {
|
|
32
|
-
pluginID,
|
|
33
|
-
errorContentsOrMethod,
|
|
34
|
-
timeTaken: 0
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
exports.createDefaultRequestData = createDefaultRequestData;
|
|
38
|
-
function createDefaultAnalytics(timeTaken, isRequestSuccessful) {
|
|
39
|
-
if (isRequestSuccessful) {
|
|
40
|
-
return {
|
|
41
|
-
sumOfTimeForSuccess: timeTaken,
|
|
42
|
-
sumOfTimeForFailure: 0,
|
|
43
|
-
successfulResponses: 0,
|
|
44
|
-
totalRequests: 0
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
return {
|
|
49
|
-
sumOfTimeForSuccess: 0,
|
|
50
|
-
sumOfTimeForFailure: timeTaken,
|
|
51
|
-
successfulResponses: 0,
|
|
52
|
-
totalRequests: 0
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
exports.createDefaultAnalytics = createDefaultAnalytics;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2019 Red Hat, Inc. 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 WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.createDefaultAnalytics = exports.createDefaultRequestData = exports.createRequestData = void 0;
|
|
19
|
+
/**
|
|
20
|
+
* Helper functions for creating an object that corresponds to the DataFromRequest interface
|
|
21
|
+
*/
|
|
22
|
+
function createRequestData(pluginID, errorContentsOrMethod, timeTaken) {
|
|
23
|
+
return {
|
|
24
|
+
pluginID,
|
|
25
|
+
errorContentsOrMethod,
|
|
26
|
+
timeTaken
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
exports.createRequestData = createRequestData;
|
|
30
|
+
function createDefaultRequestData(pluginID, errorContentsOrMethod) {
|
|
31
|
+
return {
|
|
32
|
+
pluginID,
|
|
33
|
+
errorContentsOrMethod,
|
|
34
|
+
timeTaken: 0
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
exports.createDefaultRequestData = createDefaultRequestData;
|
|
38
|
+
function createDefaultAnalytics(timeTaken, isRequestSuccessful) {
|
|
39
|
+
if (isRequestSuccessful) {
|
|
40
|
+
return {
|
|
41
|
+
sumOfTimeForSuccess: timeTaken,
|
|
42
|
+
sumOfTimeForFailure: 0,
|
|
43
|
+
successfulResponses: 0,
|
|
44
|
+
totalRequests: 0
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
return {
|
|
49
|
+
sumOfTimeForSuccess: 0,
|
|
50
|
+
sumOfTimeForFailure: timeTaken,
|
|
51
|
+
successfulResponses: 0,
|
|
52
|
+
totalRequests: 0
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.createDefaultAnalytics = createDefaultAnalytics;
|
|
57
57
|
//# sourceMappingURL=plugin-metrics-types.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MetricOutput, AnalyticsFromRequests } from '../../common/plugin-metrics-types';
|
|
2
|
-
export declare class PluginMetricTimeCount implements MetricOutput {
|
|
3
|
-
header: string;
|
|
4
|
-
createMetricOutput(id: string, method: string, requestAnalytics: AnalyticsFromRequests): string;
|
|
5
|
-
}
|
|
1
|
+
import { MetricOutput, AnalyticsFromRequests } from '../../common/plugin-metrics-types';
|
|
2
|
+
export declare class PluginMetricTimeCount implements MetricOutput {
|
|
3
|
+
header: string;
|
|
4
|
+
createMetricOutput(id: string, method: string, requestAnalytics: AnalyticsFromRequests): string;
|
|
5
|
+
}
|
|
6
6
|
//# sourceMappingURL=plugin-metrics-time-count.d.ts.map
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2019 Red Hat, Inc. 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 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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.PluginMetricTimeCount = void 0;
|
|
25
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
26
|
-
let PluginMetricTimeCount = class PluginMetricTimeCount {
|
|
27
|
-
constructor() {
|
|
28
|
-
this.header = '# HELP language_server_time_count Number of language server requests\n# TYPE language_server_time_count gauge\n';
|
|
29
|
-
}
|
|
30
|
-
createMetricOutput(id, method, requestAnalytics) {
|
|
31
|
-
if (requestAnalytics.successfulResponses < 0) {
|
|
32
|
-
requestAnalytics.successfulResponses = 0;
|
|
33
|
-
}
|
|
34
|
-
const successMetric = `language_server_time_count{id="${id}" method="${method}" result="success"} ${requestAnalytics.successfulResponses}\n`;
|
|
35
|
-
const failedRequests = requestAnalytics.totalRequests - requestAnalytics.successfulResponses;
|
|
36
|
-
const failureMetric = `language_server_time_count{id="${id}" method="${method}" result="fail"} ${failedRequests}\n`;
|
|
37
|
-
return successMetric + failureMetric;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
PluginMetricTimeCount = __decorate([
|
|
41
|
-
(0, inversify_1.injectable)()
|
|
42
|
-
], PluginMetricTimeCount);
|
|
43
|
-
exports.PluginMetricTimeCount = PluginMetricTimeCount;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2019 Red Hat, Inc. 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 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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.PluginMetricTimeCount = void 0;
|
|
25
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
26
|
+
let PluginMetricTimeCount = class PluginMetricTimeCount {
|
|
27
|
+
constructor() {
|
|
28
|
+
this.header = '# HELP language_server_time_count Number of language server requests\n# TYPE language_server_time_count gauge\n';
|
|
29
|
+
}
|
|
30
|
+
createMetricOutput(id, method, requestAnalytics) {
|
|
31
|
+
if (requestAnalytics.successfulResponses < 0) {
|
|
32
|
+
requestAnalytics.successfulResponses = 0;
|
|
33
|
+
}
|
|
34
|
+
const successMetric = `language_server_time_count{id="${id}" method="${method}" result="success"} ${requestAnalytics.successfulResponses}\n`;
|
|
35
|
+
const failedRequests = requestAnalytics.totalRequests - requestAnalytics.successfulResponses;
|
|
36
|
+
const failureMetric = `language_server_time_count{id="${id}" method="${method}" result="fail"} ${failedRequests}\n`;
|
|
37
|
+
return successMetric + failureMetric;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
PluginMetricTimeCount = __decorate([
|
|
41
|
+
(0, inversify_1.injectable)()
|
|
42
|
+
], PluginMetricTimeCount);
|
|
43
|
+
exports.PluginMetricTimeCount = PluginMetricTimeCount;
|
|
44
44
|
//# sourceMappingURL=plugin-metrics-time-count.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MetricOutput, AnalyticsFromRequests } from '../../common/plugin-metrics-types';
|
|
2
|
-
export declare class PluginMetricTimeSum implements MetricOutput {
|
|
3
|
-
header: string;
|
|
4
|
-
createMetricOutput(id: string, method: string, requestAnalytics: AnalyticsFromRequests): string;
|
|
5
|
-
}
|
|
1
|
+
import { MetricOutput, AnalyticsFromRequests } from '../../common/plugin-metrics-types';
|
|
2
|
+
export declare class PluginMetricTimeSum implements MetricOutput {
|
|
3
|
+
header: string;
|
|
4
|
+
createMetricOutput(id: string, method: string, requestAnalytics: AnalyticsFromRequests): string;
|
|
5
|
+
}
|
|
6
6
|
//# sourceMappingURL=plugin-metrics-time-sum.d.ts.map
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2019 Red Hat, Inc. 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 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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.PluginMetricTimeSum = void 0;
|
|
25
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
26
|
-
let PluginMetricTimeSum = class PluginMetricTimeSum {
|
|
27
|
-
constructor() {
|
|
28
|
-
this.header = '# HELP language_server_time_sum Sum of time in milliseconds that language server requests take\n# TYPE language_server_time_sum gauge\n';
|
|
29
|
-
}
|
|
30
|
-
createMetricOutput(id, method, requestAnalytics) {
|
|
31
|
-
const successTime = requestAnalytics.sumOfTimeForSuccess;
|
|
32
|
-
const success = `language_server_time_sum{id="${id}" method="${method}" result="success"} ${successTime}\n`;
|
|
33
|
-
const failureTime = requestAnalytics.sumOfTimeForFailure;
|
|
34
|
-
const failure = `language_server_time_sum{id="${id}" method="${method}" result="failure"} ${failureTime}\n`;
|
|
35
|
-
return success + failure;
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
PluginMetricTimeSum = __decorate([
|
|
39
|
-
(0, inversify_1.injectable)()
|
|
40
|
-
], PluginMetricTimeSum);
|
|
41
|
-
exports.PluginMetricTimeSum = PluginMetricTimeSum;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2019 Red Hat, Inc. 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 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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.PluginMetricTimeSum = void 0;
|
|
25
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
26
|
+
let PluginMetricTimeSum = class PluginMetricTimeSum {
|
|
27
|
+
constructor() {
|
|
28
|
+
this.header = '# HELP language_server_time_sum Sum of time in milliseconds that language server requests take\n# TYPE language_server_time_sum gauge\n';
|
|
29
|
+
}
|
|
30
|
+
createMetricOutput(id, method, requestAnalytics) {
|
|
31
|
+
const successTime = requestAnalytics.sumOfTimeForSuccess;
|
|
32
|
+
const success = `language_server_time_sum{id="${id}" method="${method}" result="success"} ${successTime}\n`;
|
|
33
|
+
const failureTime = requestAnalytics.sumOfTimeForFailure;
|
|
34
|
+
const failure = `language_server_time_sum{id="${id}" method="${method}" result="failure"} ${failureTime}\n`;
|
|
35
|
+
return success + failure;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
PluginMetricTimeSum = __decorate([
|
|
39
|
+
(0, inversify_1.injectable)()
|
|
40
|
+
], PluginMetricTimeSum);
|
|
41
|
+
exports.PluginMetricTimeSum = PluginMetricTimeSum;
|
|
42
42
|
//# sourceMappingURL=plugin-metrics-time-sum.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MetricsMap } from '../common/plugin-metrics-types';
|
|
2
|
-
export declare class PluginMetricStringGenerator {
|
|
3
|
-
private pluginMetricsTimeCount;
|
|
4
|
-
private pluginMetricsTimeSum;
|
|
5
|
-
getMetricsString(extensionIDAnalytics: MetricsMap): string;
|
|
6
|
-
}
|
|
1
|
+
import { MetricsMap } from '../common/plugin-metrics-types';
|
|
2
|
+
export declare class PluginMetricStringGenerator {
|
|
3
|
+
private pluginMetricsTimeCount;
|
|
4
|
+
private pluginMetricsTimeSum;
|
|
5
|
+
getMetricsString(extensionIDAnalytics: MetricsMap): string;
|
|
6
|
+
}
|
|
7
7
|
//# sourceMappingURL=metric-string-generator.d.ts.map
|