-
Notifications
You must be signed in to change notification settings - Fork 376
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
Split process request and process handles by type #260
Conversation
sorry, let me fix the linter errors |
labelNames: ['type'], | ||
registers: registry ? [registry] : undefined | ||
}); | ||
const totalGauge = new Gauge({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need a total and by type, you can just not select by labels
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SimenB I kept the separate total metric to keep backward compatibility.
If I will drop then guys who rely on this metric can loose their alerts and their graphics will be broken. I think its better to avoid breaking changes if possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we did not have labels before, I don't think it's a breaking change to add them. unless people group by labels, it'll look the exact same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SimenB metric names are different.
Original "total" gauge has name "nodejs_active_requests_total" and "nodejs_active_handles_total"
New gauges has name "nodejs_active_requests" and "nodejs_active_handles"
So everybody has to explicitly change prometheus queries from nodejs_active_requests_total to sum(nodejs_active_requests).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, my point is that we don't need new metrics since these should just be labels, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SimenB if I use same name (nodejs_active_requests_total and nodejs_active_handles_total)
then everyone have to change query from nodejs_active_handles_total to sum(nodejs_active_handles_total). And this is breaking change.
My point was to avoid make breaking changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I agree this seems best then. Thanks!
@SimenB please let me know if proposed changes can be accepted into your project or I have to live with my own fork |
I think it's a useful feature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM, but I think this might deserve a note in the docs? To explain the difference.
I'm without a computer for the weekend, so unable to publish this. So I'll leave that to the other maintainers :)
@SimenB I've updated CHANGELOG and make metrics documentation more detailed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it looks good to me as well!
Thank you, guys! |
@siimon Can you publish this version to npm please? |
I can do that |
Thank you! ;) |
Hello @siimon
In my project I found it quite useful to monitor not only total number of active requests and handles(process._getActiveRequests()/process._getActiveHandles()), but also split them by type.
If you see that number of active handles is growing but you dont know the handle type - it did not help you much track down the problem.
With this patch you will see what exactly is going wrong with your node js app.
I kept original nodejs_active_handles_total/nodejs_active_requests_total metrics for backward compatibility. So there is no breaking changes in this pull request