@theia/plugin-metrics 1.67.0-next.56 → 1.67.0-next.59

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 (61) hide show
  1. package/lib/browser/plugin-metrics-creator.d.ts +68 -0
  2. package/lib/browser/plugin-metrics-creator.d.ts.map +1 -0
  3. package/lib/browser/plugin-metrics-creator.js +178 -0
  4. package/lib/browser/plugin-metrics-creator.js.map +1 -0
  5. package/lib/browser/plugin-metrics-frontend-module.d.ts +4 -0
  6. package/lib/browser/plugin-metrics-frontend-module.d.ts.map +1 -0
  7. package/lib/browser/plugin-metrics-frontend-module.js +37 -0
  8. package/lib/browser/plugin-metrics-frontend-module.js.map +1 -0
  9. package/lib/browser/plugin-metrics-languages-main.d.ts +59 -0
  10. package/lib/browser/plugin-metrics-languages-main.d.ts.map +1 -0
  11. package/lib/browser/plugin-metrics-languages-main.js +204 -0
  12. package/lib/browser/plugin-metrics-languages-main.js.map +1 -0
  13. package/lib/browser/plugin-metrics-output-registry.d.ts +8 -0
  14. package/lib/browser/plugin-metrics-output-registry.d.ts.map +1 -0
  15. package/lib/browser/plugin-metrics-output-registry.js +41 -0
  16. package/lib/browser/plugin-metrics-output-registry.js.map +1 -0
  17. package/lib/browser/plugin-metrics-resolver.d.ts +18 -0
  18. package/lib/browser/plugin-metrics-resolver.d.ts.map +1 -0
  19. package/lib/browser/plugin-metrics-resolver.js +62 -0
  20. package/lib/browser/plugin-metrics-resolver.js.map +1 -0
  21. package/lib/common/metrics-protocol.d.ts +11 -0
  22. package/lib/common/metrics-protocol.d.ts.map +1 -0
  23. package/lib/common/metrics-protocol.js +25 -0
  24. package/lib/common/metrics-protocol.js.map +1 -0
  25. package/lib/common/plugin-metrics-types.d.ts +28 -0
  26. package/lib/common/plugin-metrics-types.d.ts.map +1 -0
  27. package/lib/common/plugin-metrics-types.js +57 -0
  28. package/lib/common/plugin-metrics-types.js.map +1 -0
  29. package/lib/node/metric-output/plugin-metrics-time-count.d.ts +6 -0
  30. package/lib/node/metric-output/plugin-metrics-time-count.d.ts.map +1 -0
  31. package/lib/node/metric-output/plugin-metrics-time-count.js +39 -0
  32. package/lib/node/metric-output/plugin-metrics-time-count.js.map +1 -0
  33. package/lib/node/metric-output/plugin-metrics-time-sum.d.ts +6 -0
  34. package/lib/node/metric-output/plugin-metrics-time-sum.d.ts.map +1 -0
  35. package/lib/node/metric-output/plugin-metrics-time-sum.js +37 -0
  36. package/lib/node/metric-output/plugin-metrics-time-sum.js.map +1 -0
  37. package/lib/node/metric-string-generator.d.ts +7 -0
  38. package/lib/node/metric-string-generator.d.ts.map +1 -0
  39. package/lib/node/metric-string-generator.js +71 -0
  40. package/lib/node/metric-string-generator.js.map +1 -0
  41. package/lib/node/metrics-contributor.d.ts +7 -0
  42. package/lib/node/metrics-contributor.d.ts.map +1 -0
  43. package/lib/node/metrics-contributor.js +72 -0
  44. package/lib/node/metrics-contributor.js.map +1 -0
  45. package/lib/node/metrics-contributor.spec.d.ts +2 -0
  46. package/lib/node/metrics-contributor.spec.d.ts.map +1 -0
  47. package/lib/node/metrics-contributor.spec.js +204 -0
  48. package/lib/node/metrics-contributor.spec.js.map +1 -0
  49. package/lib/node/plugin-metrics-backend-module.d.ts +4 -0
  50. package/lib/node/plugin-metrics-backend-module.d.ts.map +1 -0
  51. package/lib/node/plugin-metrics-backend-module.js +48 -0
  52. package/lib/node/plugin-metrics-backend-module.js.map +1 -0
  53. package/lib/node/plugin-metrics-impl.d.ts +11 -0
  54. package/lib/node/plugin-metrics-impl.d.ts.map +1 -0
  55. package/lib/node/plugin-metrics-impl.js +41 -0
  56. package/lib/node/plugin-metrics-impl.js.map +1 -0
  57. package/lib/node/plugin-metrics.d.ts +11 -0
  58. package/lib/node/plugin-metrics.d.ts.map +1 -0
  59. package/lib/node/plugin-metrics.js +47 -0
  60. package/lib/node/plugin-metrics.js.map +1 -0
  61. package/package.json +6 -6
@@ -0,0 +1,204 @@
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-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const metrics_contributor_1 = require("./metrics-contributor");
19
+ const inversify_1 = require("@theia/core/shared/inversify");
20
+ const plugin_metrics_impl_1 = require("./plugin-metrics-impl");
21
+ const metrics_protocol_1 = require("../common/metrics-protocol");
22
+ const assert = require("assert");
23
+ describe('Metrics contributor:', () => {
24
+ let testContainer;
25
+ before(() => {
26
+ testContainer = new inversify_1.Container();
27
+ const module = new inversify_1.ContainerModule(bind => {
28
+ bind(metrics_protocol_1.PluginMetrics).to(plugin_metrics_impl_1.PluginMetricsImpl).inTransientScope();
29
+ bind(metrics_contributor_1.PluginMetricsContributor).toSelf().inTransientScope();
30
+ });
31
+ testContainer.load(module);
32
+ });
33
+ describe('reconcile:', () => {
34
+ it('Reconcile with one client connected', async () => {
35
+ // given
36
+ const analytics = {
37
+ sumOfTimeForFailure: 0,
38
+ sumOfTimeForSuccess: 5,
39
+ successfulResponses: 10,
40
+ totalRequests: 15
41
+ };
42
+ const metricExtensionID = 'my_test_metric.test_metric';
43
+ const metricMethod = 'textDocument/testMethod';
44
+ const metricsMap = {
45
+ [metricExtensionID]: {
46
+ [metricMethod]: analytics
47
+ }
48
+ };
49
+ const metricsContributor = testContainer.get(metrics_contributor_1.PluginMetricsContributor);
50
+ const pluginMetrics = testContainer.get(metrics_protocol_1.PluginMetrics);
51
+ pluginMetrics.setMetrics(JSON.stringify(metricsMap));
52
+ metricsContributor.clients.add(pluginMetrics);
53
+ // when
54
+ const reconciledMap = metricsContributor.reconcile();
55
+ // then
56
+ assert.deepStrictEqual(reconciledMap, metricsMap);
57
+ });
58
+ it('Reconcile same extension id and method with two clients connected', async () => {
59
+ // given
60
+ // first client
61
+ const firstClientAnalytics = {
62
+ sumOfTimeForFailure: 0,
63
+ sumOfTimeForSuccess: 5,
64
+ successfulResponses: 10,
65
+ totalRequests: 15
66
+ };
67
+ const firstClientMetricExtensionID = 'my_test_metric.test_metric';
68
+ const firstClientMetricMethod = 'textDocument/testMethod';
69
+ const firstClientMetricsMap = {
70
+ [firstClientMetricExtensionID]: {
71
+ [firstClientMetricMethod]: firstClientAnalytics
72
+ }
73
+ };
74
+ const secondClientAnalytics = {
75
+ sumOfTimeForFailure: 0,
76
+ sumOfTimeForSuccess: 15,
77
+ successfulResponses: 20,
78
+ totalRequests: 18
79
+ };
80
+ const secondClientMetricsMap = {
81
+ [firstClientMetricExtensionID]: {
82
+ [firstClientMetricMethod]: secondClientAnalytics
83
+ }
84
+ };
85
+ const metricsContributor = testContainer.get(metrics_contributor_1.PluginMetricsContributor);
86
+ const firstClientPluginMetric = testContainer.get(metrics_protocol_1.PluginMetrics);
87
+ firstClientPluginMetric.setMetrics(JSON.stringify(firstClientMetricsMap));
88
+ metricsContributor.clients.add(firstClientPluginMetric);
89
+ const secondClientPluginMetric = testContainer.get(metrics_protocol_1.PluginMetrics);
90
+ secondClientPluginMetric.setMetrics(JSON.stringify(secondClientMetricsMap));
91
+ metricsContributor.clients.add(secondClientPluginMetric);
92
+ // when
93
+ const reconciledMap = metricsContributor.reconcile();
94
+ // then
95
+ const expectedAnalytics = {
96
+ sumOfTimeForFailure: 0,
97
+ sumOfTimeForSuccess: 20,
98
+ successfulResponses: 30,
99
+ totalRequests: 33
100
+ };
101
+ const expectedMap = {
102
+ [firstClientMetricExtensionID]: {
103
+ [firstClientMetricMethod]: expectedAnalytics
104
+ }
105
+ };
106
+ assert.deepStrictEqual(reconciledMap, expectedMap);
107
+ });
108
+ it('Reconcile different extension id and method with two clients connected', async () => {
109
+ // given
110
+ // first client
111
+ const firstClientAnalytics = {
112
+ sumOfTimeForFailure: 0,
113
+ sumOfTimeForSuccess: 5,
114
+ successfulResponses: 10,
115
+ totalRequests: 15
116
+ };
117
+ const firstClientMetricExtensionID = 'my_test_metric.test_metric';
118
+ const firstClientMetricMethod = 'textDocument/testMethod';
119
+ const firstClientMetricsMap = {
120
+ [firstClientMetricExtensionID]: {
121
+ [firstClientMetricMethod]: firstClientAnalytics
122
+ }
123
+ };
124
+ const secondClientAnalytics = {
125
+ sumOfTimeForFailure: 0,
126
+ sumOfTimeForSuccess: 15,
127
+ successfulResponses: 20,
128
+ totalRequests: 18
129
+ };
130
+ const secondClientMetricExtensionID = 'my_other_test_metric.test_metric';
131
+ const secondClientMetricsMap = {
132
+ [secondClientMetricExtensionID]: {
133
+ [firstClientMetricMethod]: secondClientAnalytics
134
+ }
135
+ };
136
+ const metricsContributor = testContainer.get(metrics_contributor_1.PluginMetricsContributor);
137
+ const firstClientPluginMetric = testContainer.get(metrics_protocol_1.PluginMetrics);
138
+ firstClientPluginMetric.setMetrics(JSON.stringify(firstClientMetricsMap));
139
+ metricsContributor.clients.add(firstClientPluginMetric);
140
+ const secondClientPluginMetric = testContainer.get(metrics_protocol_1.PluginMetrics);
141
+ secondClientPluginMetric.setMetrics(JSON.stringify(secondClientMetricsMap));
142
+ metricsContributor.clients.add(secondClientPluginMetric);
143
+ // when
144
+ const reconciledMap = metricsContributor.reconcile();
145
+ // then
146
+ const expectedMap = {
147
+ [firstClientMetricExtensionID]: {
148
+ [firstClientMetricMethod]: firstClientAnalytics
149
+ },
150
+ [secondClientMetricExtensionID]: {
151
+ [firstClientMetricMethod]: secondClientAnalytics
152
+ }
153
+ };
154
+ assert.deepStrictEqual(reconciledMap, expectedMap);
155
+ });
156
+ it('Reconcile same extension id and different method with two clients connected', async () => {
157
+ // given
158
+ // first client
159
+ const firstClientAnalytics = {
160
+ sumOfTimeForFailure: 0,
161
+ sumOfTimeForSuccess: 5,
162
+ successfulResponses: 10,
163
+ totalRequests: 15
164
+ };
165
+ const firstClientMetricExtensionID = 'my_test_metric.test_metric';
166
+ const firstClientMetricMethod = 'textDocument/testMethod';
167
+ const firstClientMetricsMap = {
168
+ [firstClientMetricExtensionID]: {
169
+ [firstClientMetricMethod]: firstClientAnalytics
170
+ }
171
+ };
172
+ const secondClientAnalytics = {
173
+ sumOfTimeForFailure: 0,
174
+ sumOfTimeForSuccess: 15,
175
+ successfulResponses: 20,
176
+ totalRequests: 18
177
+ };
178
+ const secondClientMetricMethod = 'textDocument/myOthertestMethod';
179
+ const secondClientMetricsMap = {
180
+ [firstClientMetricExtensionID]: {
181
+ [secondClientMetricMethod]: secondClientAnalytics
182
+ }
183
+ };
184
+ const metricsContributor = testContainer.get(metrics_contributor_1.PluginMetricsContributor);
185
+ const firstClientPluginMetric = testContainer.get(metrics_protocol_1.PluginMetrics);
186
+ firstClientPluginMetric.setMetrics(JSON.stringify(firstClientMetricsMap));
187
+ metricsContributor.clients.add(firstClientPluginMetric);
188
+ const secondClientPluginMetric = testContainer.get(metrics_protocol_1.PluginMetrics);
189
+ secondClientPluginMetric.setMetrics(JSON.stringify(secondClientMetricsMap));
190
+ metricsContributor.clients.add(secondClientPluginMetric);
191
+ // when
192
+ const reconciledMap = metricsContributor.reconcile();
193
+ // then
194
+ const expectedMap = {
195
+ [firstClientMetricExtensionID]: {
196
+ [firstClientMetricMethod]: firstClientAnalytics,
197
+ [secondClientMetricMethod]: secondClientAnalytics
198
+ }
199
+ };
200
+ assert.deepStrictEqual(reconciledMap, expectedMap);
201
+ });
202
+ });
203
+ });
204
+ //# sourceMappingURL=metrics-contributor.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metrics-contributor.spec.js","sourceRoot":"","sources":["../../src/node/metrics-contributor.spec.ts"],"names":[],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AC,CAAC;YAEzD,OAAO;YACP,MAAM,aAAa,GAAG,kBAAkB,CAAC,SAAS,EAAE,CAAC;YAErD,OAAO;YACP,MAAM,WAAW,GAAG;gBAChB,CAAC,4BAA4B,CAAC,EAAE;oBAC5B,CAAC,uBAAuB,CAAC,EAAE,oBAAoB;oBAC/C,CAAC,wBAAwB,CAAC,EAAE,qBAAqB;iBACpD;aACJ,CAAC;YAEF,MAAM,CAAC,eAAe,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AAEP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { ContainerModule } from '@theia/core/shared/inversify';
2
+ declare const _default: ContainerModule;
3
+ export default _default;
4
+ //# sourceMappingURL=plugin-metrics-backend-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-metrics-backend-module.d.ts","sourceRoot":"","sources":["../../src/node/plugin-metrics-backend-module.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AAM/D,wBAoBG"}
@@ -0,0 +1,48 @@
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-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const metrics_contribution_1 = require("@theia/metrics/lib/node/metrics-contribution");
19
+ const plugin_metrics_1 = require("./plugin-metrics");
20
+ const metrics_protocol_1 = require("../common/metrics-protocol");
21
+ const plugin_metrics_impl_1 = require("./plugin-metrics-impl");
22
+ const handler_1 = require("@theia/core/lib/common/messaging/handler");
23
+ const core_1 = require("@theia/core");
24
+ const inversify_1 = require("@theia/core/shared/inversify");
25
+ const metrics_contributor_1 = require("./metrics-contributor");
26
+ const plugin_metrics_time_sum_1 = require("./metric-output/plugin-metrics-time-sum");
27
+ const plugin_metrics_time_count_1 = require("./metric-output/plugin-metrics-time-count");
28
+ const metric_string_generator_1 = require("./metric-string-generator");
29
+ exports.default = new inversify_1.ContainerModule((bind, unbind, isBound, rebind) => {
30
+ bind(plugin_metrics_time_sum_1.PluginMetricTimeSum).toSelf().inSingletonScope();
31
+ bind(plugin_metrics_time_count_1.PluginMetricTimeCount).toSelf().inSingletonScope();
32
+ bind(metrics_protocol_1.PluginMetrics).to(plugin_metrics_impl_1.PluginMetricsImpl).inTransientScope();
33
+ bind(metric_string_generator_1.PluginMetricStringGenerator).toSelf().inSingletonScope();
34
+ bind(metrics_contributor_1.PluginMetricsContributor).toSelf().inSingletonScope();
35
+ bind(handler_1.ConnectionHandler).toDynamicValue(ctx => {
36
+ const clients = ctx.container.get(metrics_contributor_1.PluginMetricsContributor);
37
+ return new core_1.RpcConnectionHandler(metrics_protocol_1.metricsJsonRpcPath, client => {
38
+ const pluginMetricsHandler = ctx.container.get(metrics_protocol_1.PluginMetrics);
39
+ clients.clients.add(pluginMetricsHandler);
40
+ client.onDidCloseConnection(() => {
41
+ clients.clients.delete(pluginMetricsHandler);
42
+ });
43
+ return pluginMetricsHandler;
44
+ });
45
+ }).inSingletonScope();
46
+ bind(metrics_contribution_1.MetricsContribution).to(plugin_metrics_1.PluginMetricsContribution).inSingletonScope();
47
+ });
48
+ //# sourceMappingURL=plugin-metrics-backend-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-metrics-backend-module.js","sourceRoot":"","sources":["../../src/node/plugin-metrics-backend-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AAC,oBAAoB,CAAC,CAAC;YAC1C,MAAM,CAAC,oBAAoB,CAAC,GAAG,EAAE;gBAC7B,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;YACjD,CAAC,CAAC,CAAC;YACH,OAAO,oBAAoB,CAAC;QAChC,CAAC,CAAC,CAAC;IACP,CAAC,CACA,CAAC,gBAAgB,EAAE,CAAC;IAErB,IAAI,CAAC,0CAAmB,CAAC,CAAC,EAAE,CAAC,0CAAyB,CAAC,CAAC,gBAAgB,EAAE,CAAC;AAC/E,CAAC,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { PluginMetrics } from '../common/metrics-protocol';
2
+ export declare class PluginMetricsImpl implements PluginMetrics {
3
+ private metrics;
4
+ setMetrics(metrics: string): void;
5
+ /**
6
+ * This sends all the information about metrics inside of the plugins to the backend
7
+ * where it is served on the /metrics endpoint
8
+ */
9
+ getMetrics(): string;
10
+ }
11
+ //# sourceMappingURL=plugin-metrics-impl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-metrics-impl.d.ts","sourceRoot":"","sources":["../../src/node/plugin-metrics-impl.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,qBACa,iBAAkB,YAAW,aAAa;IAEnD,OAAO,CAAC,OAAO,CAAgB;IAG/B,UAAU,CAAC,OAAO,EAAE,MAAM;IAI1B;;;OAGG;IACH,UAAU,IAAI,MAAM;CAIvB"}
@@ -0,0 +1,41 @@
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-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.PluginMetricsImpl = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const inversify_1 = require("@theia/core/shared/inversify");
21
+ let PluginMetricsImpl = class PluginMetricsImpl {
22
+ constructor() {
23
+ this.metrics = '{}';
24
+ }
25
+ // tslint:disable-next-line:typedef
26
+ setMetrics(metrics) {
27
+ this.metrics = metrics;
28
+ }
29
+ /**
30
+ * This sends all the information about metrics inside of the plugins to the backend
31
+ * where it is served on the /metrics endpoint
32
+ */
33
+ getMetrics() {
34
+ return this.metrics;
35
+ }
36
+ };
37
+ exports.PluginMetricsImpl = PluginMetricsImpl;
38
+ exports.PluginMetricsImpl = PluginMetricsImpl = tslib_1.__decorate([
39
+ (0, inversify_1.injectable)()
40
+ ], PluginMetricsImpl);
41
+ //# sourceMappingURL=plugin-metrics-impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-metrics-impl.js","sourceRoot":"","sources":["../../src/node/plugin-metrics-impl.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,4DAA0D;AAInD,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAAvB;QAEK,YAAO,GAAW,IAAI,CAAC;IAenC,CAAC;IAbG,mCAAmC;IACnC,UAAU,CAAC,OAAe;QACtB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACH,UAAU;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;CAEJ,CAAA;AAjBY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,sBAAU,GAAE;GACA,iBAAiB,CAiB7B"}
@@ -0,0 +1,11 @@
1
+ import { MetricsContribution } from '@theia/metrics/lib/node/metrics-contribution';
2
+ import { PluginMetricsContributor } from './metrics-contributor';
3
+ import { PluginMetricStringGenerator } from './metric-string-generator';
4
+ export declare class PluginMetricsContribution implements MetricsContribution {
5
+ protected readonly metricsContributor: PluginMetricsContributor;
6
+ protected readonly stringGenerator: PluginMetricStringGenerator;
7
+ private metrics;
8
+ getMetrics(): string;
9
+ startCollecting(): void;
10
+ }
11
+ //# sourceMappingURL=plugin-metrics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-metrics.d.ts","sourceRoot":"","sources":["../../src/node/plugin-metrics.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAEnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAExE,qBACa,yBAA0B,YAAW,mBAAmB;IAGjE,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,wBAAwB,CAAC;IAGhE,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,2BAA2B,CAAC;IAEhE,OAAO,CAAC,OAAO,CAAS;IAExB,UAAU,IAAI,MAAM;IAIpB,eAAe,IAAI,IAAI;CAM1B"}
@@ -0,0 +1,47 @@
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-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.PluginMetricsContribution = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const inversify_1 = require("@theia/core/shared/inversify");
21
+ const metrics_protocol_1 = require("../common/metrics-protocol");
22
+ const metrics_contributor_1 = require("./metrics-contributor");
23
+ const metric_string_generator_1 = require("./metric-string-generator");
24
+ let PluginMetricsContribution = class PluginMetricsContribution {
25
+ getMetrics() {
26
+ return this.metrics;
27
+ }
28
+ startCollecting() {
29
+ setInterval(() => {
30
+ const reconciledMetrics = this.metricsContributor.reconcile();
31
+ this.metrics = this.stringGenerator.getMetricsString(reconciledMetrics);
32
+ }, metrics_protocol_1.METRICS_TIMEOUT);
33
+ }
34
+ };
35
+ exports.PluginMetricsContribution = PluginMetricsContribution;
36
+ tslib_1.__decorate([
37
+ (0, inversify_1.inject)(metrics_contributor_1.PluginMetricsContributor),
38
+ tslib_1.__metadata("design:type", metrics_contributor_1.PluginMetricsContributor)
39
+ ], PluginMetricsContribution.prototype, "metricsContributor", void 0);
40
+ tslib_1.__decorate([
41
+ (0, inversify_1.inject)(metric_string_generator_1.PluginMetricStringGenerator),
42
+ tslib_1.__metadata("design:type", metric_string_generator_1.PluginMetricStringGenerator)
43
+ ], PluginMetricsContribution.prototype, "stringGenerator", void 0);
44
+ exports.PluginMetricsContribution = PluginMetricsContribution = tslib_1.__decorate([
45
+ (0, inversify_1.injectable)()
46
+ ], PluginMetricsContribution);
47
+ //# sourceMappingURL=plugin-metrics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-metrics.js","sourceRoot":"","sources":["../../src/node/plugin-metrics.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,4DAAkE;AAElE,iEAA6D;AAC7D,+DAAiE;AACjE,uEAAwE;AAGjE,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAUlC,UAAU;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,eAAe;QACX,WAAW,CAAC,GAAG,EAAE;YACb,MAAM,iBAAiB,GAAG,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,CAAC;YAC9D,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;QAC5E,CAAC,EAAE,kCAAe,CAAC,CAAC;IACxB,CAAC;CACJ,CAAA;AApBY,8DAAyB;AAGf;IADlB,IAAA,kBAAM,EAAC,8CAAwB,CAAC;sCACM,8CAAwB;qEAAC;AAG7C;IADlB,IAAA,kBAAM,EAAC,qDAA2B,CAAC;sCACA,qDAA2B;kEAAC;oCANvD,yBAAyB;IADrC,IAAA,sBAAU,GAAE;GACA,yBAAyB,CAoBrC"}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@theia/plugin-metrics",
3
- "version": "1.67.0-next.56+d8f18cc386c",
3
+ "version": "1.67.0-next.59+3f14297ea",
4
4
  "description": "Theia - Plugin Metrics",
5
5
  "dependencies": {
6
- "@theia/core": "1.67.0-next.56+d8f18cc386c",
7
- "@theia/metrics": "1.67.0-next.56+d8f18cc386c",
6
+ "@theia/core": "1.67.0-next.59+3f14297ea",
7
+ "@theia/metrics": "1.67.0-next.59+3f14297ea",
8
8
  "@theia/monaco-editor-core": "1.96.302",
9
- "@theia/plugin": "1.67.0-next.56+d8f18cc386c",
10
- "@theia/plugin-ext": "1.67.0-next.56+d8f18cc386c",
9
+ "@theia/plugin": "1.67.0-next.59+3f14297ea",
10
+ "@theia/plugin-ext": "1.67.0-next.59+3f14297ea",
11
11
  "tslib": "^2.6.2"
12
12
  },
13
13
  "publishConfig": {
@@ -49,5 +49,5 @@
49
49
  "nyc": {
50
50
  "extends": "../../configs/nyc.json"
51
51
  },
52
- "gitHead": "d8f18cc386c45a736cd193d42eab02c8f64c6b10"
52
+ "gitHead": "3f14297ea2edcdb1fffd74afee0613e70b43e125"
53
53
  }