@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.
Files changed (48) hide show
  1. package/LICENSE +641 -641
  2. package/README.md +63 -63
  3. package/lib/browser/plugin-metrics-creator.d.ts +67 -67
  4. package/lib/browser/plugin-metrics-creator.js +185 -185
  5. package/lib/browser/plugin-metrics-frontend-module.d.ts +3 -3
  6. package/lib/browser/plugin-metrics-frontend-module.js +36 -36
  7. package/lib/browser/plugin-metrics-languages-main.d.ts +58 -58
  8. package/lib/browser/plugin-metrics-languages-main.js +211 -211
  9. package/lib/browser/plugin-metrics-output-registry.d.ts +7 -7
  10. package/lib/browser/plugin-metrics-output-registry.js +48 -48
  11. package/lib/browser/plugin-metrics-resolver.d.ts +17 -17
  12. package/lib/browser/plugin-metrics-resolver.js +69 -69
  13. package/lib/common/metrics-protocol.d.ts +10 -10
  14. package/lib/common/metrics-protocol.js +24 -24
  15. package/lib/common/plugin-metrics-types.d.ts +27 -27
  16. package/lib/common/plugin-metrics-types.js +56 -56
  17. package/lib/node/metric-output/plugin-metrics-time-count.d.ts +5 -5
  18. package/lib/node/metric-output/plugin-metrics-time-count.js +43 -43
  19. package/lib/node/metric-output/plugin-metrics-time-sum.d.ts +5 -5
  20. package/lib/node/metric-output/plugin-metrics-time-sum.js +41 -41
  21. package/lib/node/metric-string-generator.d.ts +6 -6
  22. package/lib/node/metric-string-generator.js +78 -78
  23. package/lib/node/metrics-contributor.d.ts +6 -6
  24. package/lib/node/metrics-contributor.js +76 -76
  25. package/lib/node/metrics-contributor.spec.d.ts +1 -1
  26. package/lib/node/metrics-contributor.spec.js +203 -203
  27. package/lib/node/plugin-metrics-backend-module.d.ts +3 -3
  28. package/lib/node/plugin-metrics-backend-module.js +47 -47
  29. package/lib/node/plugin-metrics-impl.d.ts +10 -10
  30. package/lib/node/plugin-metrics-impl.js +45 -45
  31. package/lib/node/plugin-metrics.d.ts +10 -10
  32. package/lib/node/plugin-metrics.js +54 -54
  33. package/package.json +7 -7
  34. package/src/browser/plugin-metrics-creator.ts +189 -189
  35. package/src/browser/plugin-metrics-frontend-module.ts +38 -38
  36. package/src/browser/plugin-metrics-languages-main.ts +325 -325
  37. package/src/browser/plugin-metrics-output-registry.ts +37 -37
  38. package/src/browser/plugin-metrics-resolver.ts +57 -57
  39. package/src/common/metrics-protocol.ts +27 -27
  40. package/src/common/plugin-metrics-types.ts +80 -80
  41. package/src/node/metric-output/plugin-metrics-time-count.ts +36 -36
  42. package/src/node/metric-output/plugin-metrics-time-sum.ts +35 -35
  43. package/src/node/metric-string-generator.ts +70 -70
  44. package/src/node/metrics-contributor.spec.ts +234 -234
  45. package/src/node/metrics-contributor.ts +70 -70
  46. package/src/node/plugin-metrics-backend-module.ts +49 -49
  47. package/src/node/plugin-metrics-impl.ts +38 -38
  48. package/src/node/plugin-metrics.ts +44 -44
@@ -1,79 +1,79 @@
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.PluginMetricStringGenerator = void 0;
13
- // *****************************************************************************
14
- // Copyright (C) 2019 Red Hat, Inc. 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 WITH Classpath-exception-2.0
27
- // *****************************************************************************
28
- const plugin_metrics_time_count_1 = require("./metric-output/plugin-metrics-time-count");
29
- const plugin_metrics_time_sum_1 = require("./metric-output/plugin-metrics-time-sum");
30
- const inversify_1 = require("@theia/core/shared/inversify");
31
- let PluginMetricStringGenerator = class PluginMetricStringGenerator {
32
- getMetricsString(extensionIDAnalytics) {
33
- if (Object.keys(extensionIDAnalytics).length === 0) {
34
- return '';
35
- }
36
- let metricString = this.pluginMetricsTimeCount.header;
37
- for (const extensionID in extensionIDAnalytics) {
38
- if (!extensionIDAnalytics.hasOwnProperty(extensionID)) {
39
- continue;
40
- }
41
- const methodToAnalytic = extensionIDAnalytics[extensionID];
42
- for (const method in methodToAnalytic) {
43
- if (!methodToAnalytic.hasOwnProperty(method)) {
44
- continue;
45
- }
46
- const analytic = methodToAnalytic[method];
47
- metricString += this.pluginMetricsTimeCount.createMetricOutput(extensionID, method, analytic);
48
- }
49
- }
50
- metricString += this.pluginMetricsTimeSum.header;
51
- for (const extensionID in extensionIDAnalytics) {
52
- if (!extensionIDAnalytics.hasOwnProperty(extensionID)) {
53
- continue;
54
- }
55
- const methodToAnalytic = extensionIDAnalytics[extensionID];
56
- for (const method in methodToAnalytic) {
57
- if (!methodToAnalytic.hasOwnProperty(method)) {
58
- continue;
59
- }
60
- const analytic = methodToAnalytic[method];
61
- metricString += this.pluginMetricsTimeSum.createMetricOutput(extensionID, method, analytic);
62
- }
63
- }
64
- return metricString;
65
- }
66
- };
67
- __decorate([
68
- (0, inversify_1.inject)(plugin_metrics_time_count_1.PluginMetricTimeCount),
69
- __metadata("design:type", plugin_metrics_time_count_1.PluginMetricTimeCount)
70
- ], PluginMetricStringGenerator.prototype, "pluginMetricsTimeCount", void 0);
71
- __decorate([
72
- (0, inversify_1.inject)(plugin_metrics_time_sum_1.PluginMetricTimeSum),
73
- __metadata("design:type", plugin_metrics_time_sum_1.PluginMetricTimeSum)
74
- ], PluginMetricStringGenerator.prototype, "pluginMetricsTimeSum", void 0);
75
- PluginMetricStringGenerator = __decorate([
76
- (0, inversify_1.injectable)()
77
- ], PluginMetricStringGenerator);
78
- exports.PluginMetricStringGenerator = PluginMetricStringGenerator;
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.PluginMetricStringGenerator = void 0;
13
+ // *****************************************************************************
14
+ // Copyright (C) 2019 Red Hat, Inc. 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 WITH Classpath-exception-2.0
27
+ // *****************************************************************************
28
+ const plugin_metrics_time_count_1 = require("./metric-output/plugin-metrics-time-count");
29
+ const plugin_metrics_time_sum_1 = require("./metric-output/plugin-metrics-time-sum");
30
+ const inversify_1 = require("@theia/core/shared/inversify");
31
+ let PluginMetricStringGenerator = class PluginMetricStringGenerator {
32
+ getMetricsString(extensionIDAnalytics) {
33
+ if (Object.keys(extensionIDAnalytics).length === 0) {
34
+ return '';
35
+ }
36
+ let metricString = this.pluginMetricsTimeCount.header;
37
+ for (const extensionID in extensionIDAnalytics) {
38
+ if (!extensionIDAnalytics.hasOwnProperty(extensionID)) {
39
+ continue;
40
+ }
41
+ const methodToAnalytic = extensionIDAnalytics[extensionID];
42
+ for (const method in methodToAnalytic) {
43
+ if (!methodToAnalytic.hasOwnProperty(method)) {
44
+ continue;
45
+ }
46
+ const analytic = methodToAnalytic[method];
47
+ metricString += this.pluginMetricsTimeCount.createMetricOutput(extensionID, method, analytic);
48
+ }
49
+ }
50
+ metricString += this.pluginMetricsTimeSum.header;
51
+ for (const extensionID in extensionIDAnalytics) {
52
+ if (!extensionIDAnalytics.hasOwnProperty(extensionID)) {
53
+ continue;
54
+ }
55
+ const methodToAnalytic = extensionIDAnalytics[extensionID];
56
+ for (const method in methodToAnalytic) {
57
+ if (!methodToAnalytic.hasOwnProperty(method)) {
58
+ continue;
59
+ }
60
+ const analytic = methodToAnalytic[method];
61
+ metricString += this.pluginMetricsTimeSum.createMetricOutput(extensionID, method, analytic);
62
+ }
63
+ }
64
+ return metricString;
65
+ }
66
+ };
67
+ __decorate([
68
+ (0, inversify_1.inject)(plugin_metrics_time_count_1.PluginMetricTimeCount),
69
+ __metadata("design:type", plugin_metrics_time_count_1.PluginMetricTimeCount)
70
+ ], PluginMetricStringGenerator.prototype, "pluginMetricsTimeCount", void 0);
71
+ __decorate([
72
+ (0, inversify_1.inject)(plugin_metrics_time_sum_1.PluginMetricTimeSum),
73
+ __metadata("design:type", plugin_metrics_time_sum_1.PluginMetricTimeSum)
74
+ ], PluginMetricStringGenerator.prototype, "pluginMetricsTimeSum", void 0);
75
+ PluginMetricStringGenerator = __decorate([
76
+ (0, inversify_1.injectable)()
77
+ ], PluginMetricStringGenerator);
78
+ exports.PluginMetricStringGenerator = PluginMetricStringGenerator;
79
79
  //# sourceMappingURL=metric-string-generator.js.map
@@ -1,7 +1,7 @@
1
- import { PluginMetrics } from '../common/metrics-protocol';
2
- import { MetricsMap } from '../common/plugin-metrics-types';
3
- export declare class PluginMetricsContributor {
4
- clients: Set<PluginMetrics>;
5
- reconcile(): MetricsMap;
6
- }
1
+ import { PluginMetrics } from '../common/metrics-protocol';
2
+ import { MetricsMap } from '../common/plugin-metrics-types';
3
+ export declare class PluginMetricsContributor {
4
+ clients: Set<PluginMetrics>;
5
+ reconcile(): MetricsMap;
6
+ }
7
7
  //# sourceMappingURL=metrics-contributor.d.ts.map
@@ -1,77 +1,77 @@
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.PluginMetricsContributor = void 0;
25
- const inversify_1 = require("@theia/core/shared/inversify");
26
- let PluginMetricsContributor = class PluginMetricsContributor {
27
- constructor() {
28
- this.clients = new Set();
29
- }
30
- reconcile() {
31
- const reconciledMap = {};
32
- this.clients.forEach(c => {
33
- const extensionIDtoMap = JSON.parse(c.getMetrics());
34
- for (const vscodeExtensionID in extensionIDtoMap) {
35
- if (!extensionIDtoMap.hasOwnProperty(vscodeExtensionID)) {
36
- continue;
37
- }
38
- if (!reconciledMap[vscodeExtensionID]) {
39
- reconciledMap[vscodeExtensionID] = extensionIDtoMap[vscodeExtensionID];
40
- }
41
- else {
42
- const methodToAnalytics = extensionIDtoMap[vscodeExtensionID];
43
- for (const method in methodToAnalytics) {
44
- if (!methodToAnalytics.hasOwnProperty(method)) {
45
- continue;
46
- }
47
- if (!reconciledMap[vscodeExtensionID][method]) {
48
- reconciledMap[vscodeExtensionID][method] = methodToAnalytics[method];
49
- }
50
- else {
51
- const currentAnalytic = reconciledMap[vscodeExtensionID][method];
52
- if (!methodToAnalytics[method]) {
53
- reconciledMap[vscodeExtensionID][method] = currentAnalytic;
54
- }
55
- else {
56
- // It does have the method
57
- // Then we need to reconcile the two analytics from requests
58
- const newAnalytic = methodToAnalytics[method];
59
- newAnalytic.sumOfTimeForSuccess = newAnalytic.sumOfTimeForSuccess + currentAnalytic.sumOfTimeForSuccess;
60
- newAnalytic.sumOfTimeForFailure = newAnalytic.sumOfTimeForFailure + currentAnalytic.sumOfTimeForFailure;
61
- newAnalytic.totalRequests += currentAnalytic.totalRequests;
62
- newAnalytic.successfulResponses += currentAnalytic.successfulResponses;
63
- reconciledMap[vscodeExtensionID][method] = newAnalytic;
64
- }
65
- }
66
- }
67
- }
68
- }
69
- });
70
- return reconciledMap;
71
- }
72
- };
73
- PluginMetricsContributor = __decorate([
74
- (0, inversify_1.injectable)()
75
- ], PluginMetricsContributor);
76
- exports.PluginMetricsContributor = PluginMetricsContributor;
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.PluginMetricsContributor = void 0;
25
+ const inversify_1 = require("@theia/core/shared/inversify");
26
+ let PluginMetricsContributor = class PluginMetricsContributor {
27
+ constructor() {
28
+ this.clients = new Set();
29
+ }
30
+ reconcile() {
31
+ const reconciledMap = {};
32
+ this.clients.forEach(c => {
33
+ const extensionIDtoMap = JSON.parse(c.getMetrics());
34
+ for (const vscodeExtensionID in extensionIDtoMap) {
35
+ if (!extensionIDtoMap.hasOwnProperty(vscodeExtensionID)) {
36
+ continue;
37
+ }
38
+ if (!reconciledMap[vscodeExtensionID]) {
39
+ reconciledMap[vscodeExtensionID] = extensionIDtoMap[vscodeExtensionID];
40
+ }
41
+ else {
42
+ const methodToAnalytics = extensionIDtoMap[vscodeExtensionID];
43
+ for (const method in methodToAnalytics) {
44
+ if (!methodToAnalytics.hasOwnProperty(method)) {
45
+ continue;
46
+ }
47
+ if (!reconciledMap[vscodeExtensionID][method]) {
48
+ reconciledMap[vscodeExtensionID][method] = methodToAnalytics[method];
49
+ }
50
+ else {
51
+ const currentAnalytic = reconciledMap[vscodeExtensionID][method];
52
+ if (!methodToAnalytics[method]) {
53
+ reconciledMap[vscodeExtensionID][method] = currentAnalytic;
54
+ }
55
+ else {
56
+ // It does have the method
57
+ // Then we need to reconcile the two analytics from requests
58
+ const newAnalytic = methodToAnalytics[method];
59
+ newAnalytic.sumOfTimeForSuccess = newAnalytic.sumOfTimeForSuccess + currentAnalytic.sumOfTimeForSuccess;
60
+ newAnalytic.sumOfTimeForFailure = newAnalytic.sumOfTimeForFailure + currentAnalytic.sumOfTimeForFailure;
61
+ newAnalytic.totalRequests += currentAnalytic.totalRequests;
62
+ newAnalytic.successfulResponses += currentAnalytic.successfulResponses;
63
+ reconciledMap[vscodeExtensionID][method] = newAnalytic;
64
+ }
65
+ }
66
+ }
67
+ }
68
+ }
69
+ });
70
+ return reconciledMap;
71
+ }
72
+ };
73
+ PluginMetricsContributor = __decorate([
74
+ (0, inversify_1.injectable)()
75
+ ], PluginMetricsContributor);
76
+ exports.PluginMetricsContributor = PluginMetricsContributor;
77
77
  //# sourceMappingURL=metrics-contributor.js.map
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=metrics-contributor.spec.d.ts.map