@theia/metrics 1.48.1 → 1.48.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) 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 +58 -58
  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 +19 -19
  8. package/lib/common/measurement-notification-service.d.ts +11 -11
  9. package/lib/common/measurement-notification-service.js +20 -20
  10. package/lib/electron-node/electron-metrics-backend-module.d.ts +3 -3
  11. package/lib/electron-node/electron-metrics-backend-module.js +24 -24
  12. package/lib/electron-node/electron-token-validator.d.ts +9 -9
  13. package/lib/electron-node/electron-token-validator.js +43 -43
  14. package/lib/node/extensions-metrics-contribution.d.ts +8 -8
  15. package/lib/node/extensions-metrics-contribution.js +54 -54
  16. package/lib/node/index.d.ts +5 -5
  17. package/lib/node/index.js +23 -23
  18. package/lib/node/measurement-metrics-contribution.d.ts +17 -17
  19. package/lib/node/measurement-metrics-contribution.js +75 -75
  20. package/lib/node/metrics-backend-application-contribution.d.ts +16 -16
  21. package/lib/node/metrics-backend-application-contribution.js +50 -50
  22. package/lib/node/metrics-backend-module.d.ts +3 -3
  23. package/lib/node/metrics-backend-module.js +35 -35
  24. package/lib/node/metrics-contribution.d.ts +5 -5
  25. package/lib/node/metrics-contribution.js +19 -19
  26. package/lib/node/node-metrics-contribution.d.ts +5 -5
  27. package/lib/node/node-metrics-contribution.js +35 -35
  28. package/lib/node/prometheus.d.ts +2 -2
  29. package/lib/node/prometheus.js +27 -27
  30. package/lib/node/prometheus.spec.d.ts +1 -1
  31. package/lib/node/prometheus.spec.js +40 -40
  32. package/package.json +4 -4
  33. package/src/browser/metrics-frontend-application-contribution.ts +51 -51
  34. package/src/browser/metrics-frontend-module.ts +28 -28
  35. package/src/common/index.ts +17 -17
  36. package/src/common/measurement-notification-service.ts +29 -29
  37. package/src/electron-node/electron-metrics-backend-module.ts +24 -24
  38. package/src/electron-node/electron-token-validator.ts +37 -37
  39. package/src/node/extensions-metrics-contribution.ts +51 -51
  40. package/src/node/index.ts +21 -21
  41. package/src/node/measurement-metrics-contribution.ts +75 -75
  42. package/src/node/metrics-backend-application-contribution.ts +51 -51
  43. package/src/node/metrics-backend-module.ts +40 -40
  44. package/src/node/metrics-contribution.ts +20 -20
  45. package/src/node/node-metrics-contribution.ts +33 -33
  46. package/src/node/prometheus.spec.ts +49 -49
  47. package/src/node/prometheus.ts +25 -25
@@ -1,33 +1,33 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2018 Ericsson and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import * as prom from 'prom-client';
18
- import { injectable } from '@theia/core/shared/inversify';
19
- import { MetricsContribution } from './metrics-contribution';
20
-
21
- @injectable()
22
- export class NodeMetricsContribution implements MetricsContribution {
23
- getMetrics(): string {
24
- return prom.register.metrics().toString();
25
- }
26
-
27
- startCollecting(): void {
28
- const collectDefaultMetrics = prom.collectDefaultMetrics;
29
-
30
- // Probe every 5th second.
31
- collectDefaultMetrics({ timeout: 5000 });
32
- }
33
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2018 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import * as prom from 'prom-client';
18
+ import { injectable } from '@theia/core/shared/inversify';
19
+ import { MetricsContribution } from './metrics-contribution';
20
+
21
+ @injectable()
22
+ export class NodeMetricsContribution implements MetricsContribution {
23
+ getMetrics(): string {
24
+ return prom.register.metrics().toString();
25
+ }
26
+
27
+ startCollecting(): void {
28
+ const collectDefaultMetrics = prom.collectDefaultMetrics;
29
+
30
+ // Probe every 5th second.
31
+ collectDefaultMetrics({ timeout: 5000 });
32
+ }
33
+ }
@@ -1,49 +1,49 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2018 Ericsson and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import * as chai from 'chai';
18
- import { PROMETHEUS_REGEXP, toPrometheusValidName } from './prometheus';
19
-
20
- const expect = chai.expect;
21
-
22
- describe('Prometheus helper module', () => {
23
- /* According to https://prometheus.io/docs/concepts/data_model/ */
24
-
25
- const validName = 'theia_extension3242-:';
26
- const invalidTheiaName = '@theia/something';
27
- const validTheiaName = 'theia_something';
28
- const invalidName2 = '@theia/?$%^ ';
29
-
30
- it('Should correctly validate a metric name', () => {
31
- expect(PROMETHEUS_REGEXP.test(validName)).to.be.true;
32
-
33
- expect(PROMETHEUS_REGEXP.test(invalidTheiaName)).to.be.false;
34
-
35
- expect(PROMETHEUS_REGEXP.test(invalidName2)).to.be.false;
36
-
37
- });
38
-
39
- it('Should correctly return a valid name from an otherwise invalid prometheus string', () => {
40
- expect(PROMETHEUS_REGEXP.test(invalidTheiaName)).to.be.false;
41
-
42
- const newName = toPrometheusValidName(invalidTheiaName);
43
- expect(PROMETHEUS_REGEXP.test(newName)).to.be.true;
44
- expect(newName).to.be.equal(validTheiaName);
45
-
46
- const newName2 = toPrometheusValidName(invalidName2);
47
- expect(PROMETHEUS_REGEXP.test(newName2)).to.be.true;
48
- });
49
- });
1
+ // *****************************************************************************
2
+ // Copyright (C) 2018 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import * as chai from 'chai';
18
+ import { PROMETHEUS_REGEXP, toPrometheusValidName } from './prometheus';
19
+
20
+ const expect = chai.expect;
21
+
22
+ describe('Prometheus helper module', () => {
23
+ /* According to https://prometheus.io/docs/concepts/data_model/ */
24
+
25
+ const validName = 'theia_extension3242-:';
26
+ const invalidTheiaName = '@theia/something';
27
+ const validTheiaName = 'theia_something';
28
+ const invalidName2 = '@theia/?$%^ ';
29
+
30
+ it('Should correctly validate a metric name', () => {
31
+ expect(PROMETHEUS_REGEXP.test(validName)).to.be.true;
32
+
33
+ expect(PROMETHEUS_REGEXP.test(invalidTheiaName)).to.be.false;
34
+
35
+ expect(PROMETHEUS_REGEXP.test(invalidName2)).to.be.false;
36
+
37
+ });
38
+
39
+ it('Should correctly return a valid name from an otherwise invalid prometheus string', () => {
40
+ expect(PROMETHEUS_REGEXP.test(invalidTheiaName)).to.be.false;
41
+
42
+ const newName = toPrometheusValidName(invalidTheiaName);
43
+ expect(PROMETHEUS_REGEXP.test(newName)).to.be.true;
44
+ expect(newName).to.be.equal(validTheiaName);
45
+
46
+ const newName2 = toPrometheusValidName(invalidName2);
47
+ expect(PROMETHEUS_REGEXP.test(newName2)).to.be.true;
48
+ });
49
+ });
@@ -1,25 +1,25 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2018 Ericsson and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- export function toPrometheusValidName(name: string): string {
18
- /* Make sure that start of name is valid and respect [a-zA-Z_:] */
19
- const validFirstCharString = name.replace(/(^[^a-zA-Z_:]+)/gi, '');
20
- /* Make sure that rest of the name respect [a-zA-Z0-9_:]* */
21
- const validPrometheusName = validFirstCharString.replace(/([^a-zA-Z0-9_:])/gi, '_');
22
- return validPrometheusName;
23
- }
24
-
25
- export const PROMETHEUS_REGEXP = /^[a-zA-Z_:][a-zA-Z0-9_:]*/;
1
+ // *****************************************************************************
2
+ // Copyright (C) 2018 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ export function toPrometheusValidName(name: string): string {
18
+ /* Make sure that start of name is valid and respect [a-zA-Z_:] */
19
+ const validFirstCharString = name.replace(/(^[^a-zA-Z_:]+)/gi, '');
20
+ /* Make sure that rest of the name respect [a-zA-Z0-9_:]* */
21
+ const validPrometheusName = validFirstCharString.replace(/([^a-zA-Z0-9_:])/gi, '_');
22
+ return validPrometheusName;
23
+ }
24
+
25
+ export const PROMETHEUS_REGEXP = /^[a-zA-Z_:][a-zA-Z0-9_:]*/;