Repository navigation
Alphabetize default metrics - #817
Conversation
jdmarshall
left a comment
There was a problem hiding this comment.
I'm on my way out the door at the moment but looks promising. Thank you.
6064bd5 to
c3ce057
Compare
|
Hi @jdmarshall, no rush - just flagging that the two required checks (Run Benchmarks and Run Checks) are still waiting on a maintainer to approve the workflow run, since this comes from a fork. Happy to rebase or adjust anything if needed. |
|
Any PR that involves re-arranging things, as a rule of thumb should be prioritized to merge sooner rather than later to avoid conflicts with later initiatives. |
| heapSizeAndUsed, | ||
| gc, | ||
| heapSpacesSizeAndUsed, | ||
| version, |
There was a problem hiding this comment.
I do want to discuss one exception to the alphabetization rule.
node_version isn't really a stat, it's a configuration parameter that's part of either the build or the deployment. Having it buried like this, only someone who is really looking for it will find it, and this is, IME, one of a small number of pieces of data that people need to see more often than they believe they need to see it.
If the version is the first thing you see, then it is more likely to be seen. So I think this should be the exception to the alphabetical rule and should be at the top of the output.
|
Also a Changelog entry would be good, something like "organized the default metrics" But we need a new section for it: |
Register default metric modules in alphabetical order of their metric name in defaultMetrics.js. Move the shared collect() in heapSizeAndUsed from the total gauge to the external gauge, since nodejs_external_memory_bytes now sorts first. Add a test asserting module registration order is alphabetical. Signed-off-by: Jon Suguiyama <[email protected]>
node_version describes build and deployment configuration rather than a runtime statistic, so register it ahead of the alphabetized modules where it is easier to spot. Document the exception at the call site and assert it in the ordering test. Signed-off-by: Jon Suguiyama <[email protected]>
Signed-off-by: Jon Suguiyama <[email protected]>
c3ce057 to
8737760
Compare
|
Good call on node_version, done. It now registers first, ahead of the alphabetized modules, and I left a note at the call site so the exception does not get "fixed" back later. The ordering test asserts version first, then alphabetical for the rest. Changelog entry added in a new [Unreleased] section, using your wording. Also rebased onto main to pick up 0.16.0, so this should merge clean. Two CI notes, both independent of this PR:
|
|
Alright, I'll try to merge this tonight. |
Closes #810.
metricsobject inlib/defaultMetrics.jsalphabetically by each module's Prometheus metric name.heapSizeAndUsed.js, move the sharedcollect()from thetotalgauge to theexternalgauge, sincenodejs_external_memory_bytesnow registers first alphabetically.externalgauge first, since it now owns the shared collect.