Skip to content

Commit

Permalink
wipp
Browse files Browse the repository at this point in the history
  • Loading branch information
benzekrimaha committed May 10, 2024
1 parent ed6b3c1 commit 0b0d1b6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions utils/monitoring.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { errors } = require('arsenal');
const promClient = require('prom-client');
const promClient, { Registry } = require('prom-client');

const aggregatorRegistry = new promClient.AggregatorRegistry();
const { collectDefaultMetrics } = promClient;
Expand Down Expand Up @@ -70,7 +70,14 @@ async function metricsHandler(req, res) {
}

try {
const promMetrics = await aggregatorRegistry.clusterMetrics();
// const [registerMetrics, clusterMetrics] = await Promise.all([
// promClient.register.metrics(),
// aggregatorRegistry.clusterMetrics(),
// ]);
// const promMetrics = `${registerMetrics}\n${clusterMetrics}`;
const promResgisties = Registry.merge([promClient.register, aggregatorRegistry]);
const promMetrics = await promResgisties.metrics();
console.log(`prom metrics ${promMetrics}`);
const contentLen = Buffer.byteLength(promMetrics, 'utf8');
return res.writeHead(200, {
'content-length': contentLen,
Expand Down

0 comments on commit 0b0d1b6

Please sign in to comment.