-
Notifications
You must be signed in to change notification settings - Fork 378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow master to add its own metrics #183
Comments
I've never used the cluster code, @zbjornson? |
Is there a way to aggregate clusterMetrics() result with default register.metrics metricsServer.get('/metrics', (req, res) => {
aggregatorRegistry.clusterMetrics()
.then(metrics => {
res.set('Content-Type', aggregatorRegistry.contentType)
// How to merge 'metrics' with register.metrics ?
res.send(metrics))
})
.catch(err => {
error(err)
return res.status(500).end(err)
})
}) |
@miton18 Since the Prometheus metrics format is plain text, I think that you can just concatenate the string from metricsServer.get('/metrics', (req, res) => {
aggregatorRegistry.clusterMetrics()
.then(metrics => {
res.set('Content-Type', aggregatorRegistry.contentType)
metrics += otherRegistry.metrics(); // <-- added
res.send(metrics))
})
.catch(err => {
error(err)
return res.status(500).end(err)
})
}) |
Yes we can... and it's works ;-) But I asking if it wasn't interesting to natively add Master metrics with workers ones ? |
Ah, probably! Happy to review a PR for that. |
This will only work if there is no overlap between the metrics, otherwise you could end up with invalid output. |
There are any updates? It would be nice to have #280 merged |
#280 just need tests. If anyone here can contribute a test, we can get that PR landed! |
Hi !
I work on clustered Node app.
I have some issues when trying to have worker(s) metrics with cluster ones.
Is master process alllowed to expose his own metrics (registered on default Registry) ?
https://github.com/siimon/prom-client/blob/master/lib/cluster.js#L169
The text was updated successfully, but these errors were encountered: