-
Notifications
You must be signed in to change notification settings - Fork 2
/
metrics.js
33 lines (28 loc) · 897 Bytes
/
metrics.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const client = require('prom-client');
const httpRequestsTotal = new client.Counter({
name: 'http_requests_total',
help: 'Total number of HTTP requests made.',
labelNames: ['code', 'method'],
});
const httpRequestDurationMilliseconds = new client.Histogram({
name: 'http_request_duration_milliseconds',
help: 'Histogram of latencies for HTTP requests.',
buckets: [0.1, 5, 15, 50, 100, 500],
labelNames: ['method', 'handler'],
});
const processedCommentsTotal = new client.Counter({
name: 'processed_comments_total',
help: 'Total number of processed comments submitted.',
labelNames: ['domain'],
});
// Configure the prom client to send default metrics.
client.collectDefaultMetrics({ prefix: 'slack_' });
// Export the configuration.
module.exports = {
client,
metrics: {
httpRequestsTotal,
httpRequestDurationMilliseconds,
processedCommentsTotal,
},
};