-
Notifications
You must be signed in to change notification settings - Fork 68
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
Option to erase series without requests for a given time #116
Comments
wouldn't it be a feature of prom-client then? You may want to remove unused labels from other metrics too, not only |
From Gauge/Counter/Histogram/Summary classes, I can't easily know which label set has been active or not, how many entries I had, etc. I would need some kind of "labelset-to-timestamp" map to register it right before I "observe" a new value, and this is made inside this module, not prom-client ... Optional parameters could be how long should it persist and a interval to evaluate this "garbage collector" callback My case is that I have a huge API made with express, it is hard to keep track of all possible combinations of , there will be always some combinations that happens every once in a while and they will persist forever... on every per-client instance... |
if you check the code, you'd see it's a very dumb proxy to prom-client. This library has almost zero functionality and of course it doesn't keep any information about your endpoints whatsoever. So this kind of functionality would be in any case out of place here. On the other hand believe me you're not the only one having a huge API that needs to be monitored. My own solution to this is "path normalization", i.e. before a specific path gets counted it is first transformed into a generic form. E.g. See:
If the default behavior doesn't work, you may write your own normalizePath in such a way that it's not too much data but also enough for you to identify problematic areas. E.g. instead of conversion above you may turn all Hope it helps! |
Well, thanks for the tip about the path normalization. I'm already using it as it is critically necessary. About the expiration of unused <path,method,status_code>, I convinced myself that this could be resolved from There is already an issue for it: siimon/prom-client#492 |
With the prom-client fix, and this patch: diff --git a/src/index.js b/src/index.js
index 0c96dfb9ac0c9e3559b69e83ff60d09f4dcbbd23..8a0aa77516baf65efb8c7f2d3a2b757ad6abcf82 100644
--- a/src/index.js
+++ b/src/index.js
@@ -112,7 +112,8 @@ function main(opts) {
percentiles: opts.percentiles || [0.5, 0.75, 0.95, 0.98, 0.99, 0.999],
maxAgeSeconds: opts.maxAgeSeconds,
ageBuckets: opts.ageBuckets,
- registers: [opts.promRegistry]
+ registers: [opts.promRegistry],
+ pruneAgedBuckets: true,
});
} else if (opts.metricType === 'histogram' || !opts.metricType) {
return new promClient.Histogram({% Seems to work as expected. |
FWIW: #119 |
I think it would be useful if labels wouldn't persist indefinitely. If I have a set of {method,path,status_code} that has not been active for a given time, I would like to erase it from the prom-client register, therefore, not exposing it to prometheus...
The text was updated successfully, but these errors were encountered: