How to use the prom-client.register.contentType function in prom-client

To help you get started, we’ve selected a few prom-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AugustArchive / Maika / src / structures / registry / metrics.js View on Github external
.createServer((req, res) => {
                console.log(`[Metrics] [info]: ${req.url} was requested.`);
                if (url.parse(req.url) === '/metrics') {
                    res.writeHead(200, { 'Content-Type': register.contentType });
                    res.write(register.metrics());
                    res.end();
                }
            }).listen(5590);
    }
github Hydractify / kanna_kobayashi / src / Shard.ts View on Github external
createServer(async (req: IncomingMessage, res: ServerResponse): Promise =>
{
	try
	{
		if (parse(req.url ?? '').pathname === '/metrics')
		{
			const metrics: object[][] = await manager.broadcastEval('this.getMetrics()');
			res.writeHead(200, { 'content-type': register.contentType });
			res.write(AggregatorRegistry.aggregate(metrics).metrics());
		}
		else
		{
			res.writeHead(404, { 'content-type': register.contentType });
			res.write('Route not found');
		}
	}
	catch (e)
	{
		webhook.error('Prometheus', 'Manager', e);

		res.writeHead(500, { 'content-type': register.contentType });
		res.write('Internal Server Error');
	}
	res.end();
github calzoneman / sync / src / prometheus-server.js View on Github external
server = http.createServer((req, res) => {
        if (req.method !== 'GET'
                || parseURL(req.url).pathname !== prometheusConfig.getPath()) {
            res.writeHead(400, { 'Content-Type': 'text/plain' });
            res.end('Bad Request');
            return;
        }

        res.writeHead(200, {
            'Content-Type': register.contentType
        });
        res.end(register.metrics());
    });
github Unleash / unleash / lib / routes / backstage.js View on Github external
this.get('/prometheus', (req, res) => {
                res.set('Content-Type', prometheusRegister.contentType);
                res.end(prometheusRegister.metrics());
            });
        }
github AraiEzzra / DDKCORE / backlog / prometheus.js View on Github external
App.get('/metrics', (req, res) => {
        res.set('Content-Type', Register.contentType);
        res.end(Register.metrics());
    });
};
github Hydractify / kanna_kobayashi / src / Shard.ts View on Github external
{
			const metrics: object[][] = await manager.broadcastEval('this.getMetrics()');
			res.writeHead(200, { 'content-type': register.contentType });
			res.write(AggregatorRegistry.aggregate(metrics).metrics());
		}
		else
		{
			res.writeHead(404, { 'content-type': register.contentType });
			res.write('Route not found');
		}
	}
	catch (e)
	{
		webhook.error('Prometheus', 'Manager', e);

		res.writeHead(500, { 'content-type': register.contentType });
		res.write('Internal Server Error');
	}
	res.end();
}).listen(httpPort, () => webhook.info('Prometheus', 'Manager', 'Listening for requests...'));
github coralproject / talk / src / core / server / app / router / index.ts View on Github external
router.get("/metrics", noCacheMiddleware, (req, res) => {
      res.set("Content-Type", register.contentType);
      res.end(register.metrics());
    });
    logger.info({ path: "/metrics" }, "mounting metrics path on app");
github ClearcodeHQ / nodejs-microservice-boilerplate / src / modules / healthcheck.js View on Github external
server.get('/metrics', (req, res) => {
  res.status(200);
  res.set('Content-Type', register.contentType);
  res.end(register.metrics());
});