@biorate/prometheus 0.30.2 → 0.30.7
Sign up to get free protection for your applications and to get access to all the features.
- package/.nyc_output/{ad232d3e-5688-427e-9a20-261aa10fa118.json → 7f81122d-e699-4b09-a95c-f4657d81ad2f.json} +1 -1
- package/.nyc_output/processinfo/7f81122d-e699-4b09-a95c-f4657d81ad2f.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -1
- package/CHANGELOG.md +32 -0
- package/coverage/lcov-report/index.html +1 -1
- package/coverage/lcov-report/index.ts.html +24 -621
- package/coverage/lcov.info +1 -1
- package/dist/tests/__mocks__/index.js +0 -3
- package/dist/tests/__mocks__/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/index.ts +1 -0
- package/package.json +5 -5
- package/src/index.ts +210 -0
- package/src/interfaces.ts +16 -0
- package/.nyc_output/processinfo/ad232d3e-5688-427e-9a20-261aa10fa118.json +0 -1
- package/tests/__mocks__/index.ts +0 -40
- package/tests/__snapshots__/prometheus.spec.ts.snap +0 -161
- package/tests/prometheus.spec.ts +0 -33
package/tests/__mocks__/index.ts
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
import { use } from 'chai';
|
2
|
-
import { jestSnapshotPlugin } from 'mocha-chai-jest-snapshot';
|
3
|
-
import { inject, container, Types, Core } from '@biorate/inversion';
|
4
|
-
import { IConfig, Config } from '@biorate/config';
|
5
|
-
import {
|
6
|
-
Prometheus,
|
7
|
-
IPrometheus,
|
8
|
-
counter,
|
9
|
-
gauge,
|
10
|
-
summary,
|
11
|
-
histogram,
|
12
|
-
Counter,
|
13
|
-
Gauge,
|
14
|
-
Summary,
|
15
|
-
Histogram,
|
16
|
-
} from '../../src';
|
17
|
-
|
18
|
-
use(jestSnapshotPlugin());
|
19
|
-
|
20
|
-
Core.log = null;
|
21
|
-
|
22
|
-
export class Root extends Core() {
|
23
|
-
@inject(Types.Config) public config: IConfig;
|
24
|
-
@inject(Types.Prometheus) public prometheus: IPrometheus;
|
25
|
-
|
26
|
-
@counter({ name: 'counter', help: 'counter' }) public counter: Counter;
|
27
|
-
@gauge({ name: 'gauge', help: 'gauge' }) public gauge: Gauge;
|
28
|
-
@summary({ name: 'summary', help: 'summary' }) public summary: Summary;
|
29
|
-
@histogram({ name: 'histogram', help: 'histogram' })
|
30
|
-
public histogram: Histogram;
|
31
|
-
}
|
32
|
-
container.bind(Types.Config).to(Config).inSingletonScope();
|
33
|
-
container.bind(Types.Prometheus).to(Prometheus).inSingletonScope();
|
34
|
-
container.bind(Root).toSelf().inSingletonScope();
|
35
|
-
|
36
|
-
(container.get(Types.Config) as IConfig).merge({
|
37
|
-
prometheus: {
|
38
|
-
collectDefaultMetrics: false,
|
39
|
-
},
|
40
|
-
});
|
@@ -1,161 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`Prometheus counter 1`] = `
|
4
|
-
"# HELP counter counter
|
5
|
-
# TYPE counter counter
|
6
|
-
counter 1
|
7
|
-
|
8
|
-
# HELP gauge gauge
|
9
|
-
# TYPE gauge gauge
|
10
|
-
gauge 0
|
11
|
-
|
12
|
-
# HELP summary summary
|
13
|
-
# TYPE summary summary
|
14
|
-
summary{quantile=\\"0.01\\"} 0
|
15
|
-
summary{quantile=\\"0.05\\"} 0
|
16
|
-
summary{quantile=\\"0.5\\"} 0
|
17
|
-
summary{quantile=\\"0.9\\"} 0
|
18
|
-
summary{quantile=\\"0.95\\"} 0
|
19
|
-
summary{quantile=\\"0.99\\"} 0
|
20
|
-
summary{quantile=\\"0.999\\"} 0
|
21
|
-
summary_sum 0
|
22
|
-
summary_count 0
|
23
|
-
|
24
|
-
# HELP histogram histogram
|
25
|
-
# TYPE histogram histogram
|
26
|
-
histogram_bucket{le=\\"0.005\\"} 0
|
27
|
-
histogram_bucket{le=\\"0.01\\"} 0
|
28
|
-
histogram_bucket{le=\\"0.025\\"} 0
|
29
|
-
histogram_bucket{le=\\"0.05\\"} 0
|
30
|
-
histogram_bucket{le=\\"0.1\\"} 0
|
31
|
-
histogram_bucket{le=\\"0.25\\"} 0
|
32
|
-
histogram_bucket{le=\\"0.5\\"} 0
|
33
|
-
histogram_bucket{le=\\"1\\"} 0
|
34
|
-
histogram_bucket{le=\\"2.5\\"} 0
|
35
|
-
histogram_bucket{le=\\"5\\"} 0
|
36
|
-
histogram_bucket{le=\\"10\\"} 0
|
37
|
-
histogram_bucket{le=\\"+Inf\\"} 0
|
38
|
-
histogram_sum 0
|
39
|
-
histogram_count 0
|
40
|
-
"
|
41
|
-
`;
|
42
|
-
|
43
|
-
exports[`Prometheus gauge 1`] = `
|
44
|
-
"# HELP counter counter
|
45
|
-
# TYPE counter counter
|
46
|
-
counter 1
|
47
|
-
|
48
|
-
# HELP gauge gauge
|
49
|
-
# TYPE gauge gauge
|
50
|
-
gauge 1
|
51
|
-
|
52
|
-
# HELP summary summary
|
53
|
-
# TYPE summary summary
|
54
|
-
summary{quantile=\\"0.01\\"} 0
|
55
|
-
summary{quantile=\\"0.05\\"} 0
|
56
|
-
summary{quantile=\\"0.5\\"} 0
|
57
|
-
summary{quantile=\\"0.9\\"} 0
|
58
|
-
summary{quantile=\\"0.95\\"} 0
|
59
|
-
summary{quantile=\\"0.99\\"} 0
|
60
|
-
summary{quantile=\\"0.999\\"} 0
|
61
|
-
summary_sum 0
|
62
|
-
summary_count 0
|
63
|
-
|
64
|
-
# HELP histogram histogram
|
65
|
-
# TYPE histogram histogram
|
66
|
-
histogram_bucket{le=\\"0.005\\"} 0
|
67
|
-
histogram_bucket{le=\\"0.01\\"} 0
|
68
|
-
histogram_bucket{le=\\"0.025\\"} 0
|
69
|
-
histogram_bucket{le=\\"0.05\\"} 0
|
70
|
-
histogram_bucket{le=\\"0.1\\"} 0
|
71
|
-
histogram_bucket{le=\\"0.25\\"} 0
|
72
|
-
histogram_bucket{le=\\"0.5\\"} 0
|
73
|
-
histogram_bucket{le=\\"1\\"} 0
|
74
|
-
histogram_bucket{le=\\"2.5\\"} 0
|
75
|
-
histogram_bucket{le=\\"5\\"} 0
|
76
|
-
histogram_bucket{le=\\"10\\"} 0
|
77
|
-
histogram_bucket{le=\\"+Inf\\"} 0
|
78
|
-
histogram_sum 0
|
79
|
-
histogram_count 0
|
80
|
-
"
|
81
|
-
`;
|
82
|
-
|
83
|
-
exports[`Prometheus histogram 1`] = `
|
84
|
-
"# HELP counter counter
|
85
|
-
# TYPE counter counter
|
86
|
-
counter 1
|
87
|
-
|
88
|
-
# HELP gauge gauge
|
89
|
-
# TYPE gauge gauge
|
90
|
-
gauge 1
|
91
|
-
|
92
|
-
# HELP summary summary
|
93
|
-
# TYPE summary summary
|
94
|
-
summary{quantile=\\"0.01\\"} 1
|
95
|
-
summary{quantile=\\"0.05\\"} 1
|
96
|
-
summary{quantile=\\"0.5\\"} 1
|
97
|
-
summary{quantile=\\"0.9\\"} 1
|
98
|
-
summary{quantile=\\"0.95\\"} 1
|
99
|
-
summary{quantile=\\"0.99\\"} 1
|
100
|
-
summary{quantile=\\"0.999\\"} 1
|
101
|
-
summary_sum 1
|
102
|
-
summary_count 1
|
103
|
-
|
104
|
-
# HELP histogram histogram
|
105
|
-
# TYPE histogram histogram
|
106
|
-
histogram_bucket{le=\\"0.005\\"} 0
|
107
|
-
histogram_bucket{le=\\"0.01\\"} 0
|
108
|
-
histogram_bucket{le=\\"0.025\\"} 0
|
109
|
-
histogram_bucket{le=\\"0.05\\"} 0
|
110
|
-
histogram_bucket{le=\\"0.1\\"} 0
|
111
|
-
histogram_bucket{le=\\"0.25\\"} 0
|
112
|
-
histogram_bucket{le=\\"0.5\\"} 0
|
113
|
-
histogram_bucket{le=\\"1\\"} 1
|
114
|
-
histogram_bucket{le=\\"2.5\\"} 1
|
115
|
-
histogram_bucket{le=\\"5\\"} 1
|
116
|
-
histogram_bucket{le=\\"10\\"} 1
|
117
|
-
histogram_bucket{le=\\"+Inf\\"} 1
|
118
|
-
histogram_sum 1
|
119
|
-
histogram_count 1
|
120
|
-
"
|
121
|
-
`;
|
122
|
-
|
123
|
-
exports[`Prometheus summary 1`] = `
|
124
|
-
"# HELP counter counter
|
125
|
-
# TYPE counter counter
|
126
|
-
counter 1
|
127
|
-
|
128
|
-
# HELP gauge gauge
|
129
|
-
# TYPE gauge gauge
|
130
|
-
gauge 1
|
131
|
-
|
132
|
-
# HELP summary summary
|
133
|
-
# TYPE summary summary
|
134
|
-
summary{quantile=\\"0.01\\"} 1
|
135
|
-
summary{quantile=\\"0.05\\"} 1
|
136
|
-
summary{quantile=\\"0.5\\"} 1
|
137
|
-
summary{quantile=\\"0.9\\"} 1
|
138
|
-
summary{quantile=\\"0.95\\"} 1
|
139
|
-
summary{quantile=\\"0.99\\"} 1
|
140
|
-
summary{quantile=\\"0.999\\"} 1
|
141
|
-
summary_sum 1
|
142
|
-
summary_count 1
|
143
|
-
|
144
|
-
# HELP histogram histogram
|
145
|
-
# TYPE histogram histogram
|
146
|
-
histogram_bucket{le=\\"0.005\\"} 0
|
147
|
-
histogram_bucket{le=\\"0.01\\"} 0
|
148
|
-
histogram_bucket{le=\\"0.025\\"} 0
|
149
|
-
histogram_bucket{le=\\"0.05\\"} 0
|
150
|
-
histogram_bucket{le=\\"0.1\\"} 0
|
151
|
-
histogram_bucket{le=\\"0.25\\"} 0
|
152
|
-
histogram_bucket{le=\\"0.5\\"} 0
|
153
|
-
histogram_bucket{le=\\"1\\"} 0
|
154
|
-
histogram_bucket{le=\\"2.5\\"} 0
|
155
|
-
histogram_bucket{le=\\"5\\"} 0
|
156
|
-
histogram_bucket{le=\\"10\\"} 0
|
157
|
-
histogram_bucket{le=\\"+Inf\\"} 0
|
158
|
-
histogram_sum 0
|
159
|
-
histogram_count 0
|
160
|
-
"
|
161
|
-
`;
|
package/tests/prometheus.spec.ts
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
import { expect } from 'chai';
|
2
|
-
import { container } from '@biorate/inversion';
|
3
|
-
import { Root } from './__mocks__';
|
4
|
-
|
5
|
-
describe('Prometheus', function () {
|
6
|
-
let root: Root;
|
7
|
-
this.timeout(3e4);
|
8
|
-
|
9
|
-
before(async () => {
|
10
|
-
root = container.get<Root>(Root);
|
11
|
-
await root.$run();
|
12
|
-
});
|
13
|
-
|
14
|
-
it('counter', async () => {
|
15
|
-
root.counter.inc();
|
16
|
-
expect(await root.prometheus.registry.metrics()).toMatchSnapshot();
|
17
|
-
});
|
18
|
-
|
19
|
-
it('gauge', async () => {
|
20
|
-
root.gauge.inc();
|
21
|
-
expect(await root.prometheus.registry.metrics()).toMatchSnapshot();
|
22
|
-
});
|
23
|
-
|
24
|
-
it('summary', async () => {
|
25
|
-
root.summary.observe(1);
|
26
|
-
expect(await root.prometheus.registry.metrics()).toMatchSnapshot();
|
27
|
-
});
|
28
|
-
|
29
|
-
it('histogram', async () => {
|
30
|
-
root.histogram.observe(1);
|
31
|
-
expect(await root.prometheus.registry.metrics()).toMatchSnapshot();
|
32
|
-
});
|
33
|
-
});
|