-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Custom function for process metrics #81
Comments
I think this would be really useful to provide. It should also be easy to publish the data from under-pressure to prometheus. |
In my view, I thought that when the user passes a custom
I am not sure this is a nice DX, though, because I am not using the plugins' built-in dependencies check of fastify-plugin. |
It seems fair! My only concern is that under-pressure works specifically with a certain set of metrics. My making those optional, what would be left? It might be better to figure out the prometheus integration and adapt this module accordingly. |
Exactly, that was my concern also, but I don't see a way to validate the metrics returned at plugin-registration time atm. All that would be left is the user common sense, unfortunately. |
What about providing a map to the Line 156 in 441c552
|
Yes, that would work too. So, for example, something like this? fastify.decorate('metrics', {
eventLoopUtilization: 0,
....
})
fastify.register(require('under-pressure'), {
maxEventLoopUtilization:0.98,
metrics: fastify.metrics
})
fastify.get('/', (req, reply) => {
reply.send({ hello: 'world'})
})
fastify.listen(3000, err => {
if (err) throw err
console.log(`server listening on ${fastify.server.address().port}`)
}) I think it might share the same problem of metrics definition, though. |
🚀 Feature Proposal
Expose a custom function to gather process metrics.
Motivation
There are cases in which there's already a module/library that monitors process metrics, for example, to report to
statsd
/prometeus
and similar platforms. This would allow reusing those modules for a similar task.Example
Notes
There are a lot of details to figure out here, like defining a way to make sure the object returned by the custom
usage
function is safe to use (i.e., it defines all the properties needed), but I just wanted to start a discussion to understand if it's something this plugin could provide.The text was updated successfully, but these errors were encountered: