Skip to content
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

Expose only topk metrics to Prometheus #205

Open
phihos opened this issue Aug 1, 2022 · 0 comments
Open

Expose only topk metrics to Prometheus #205

phihos opened this issue Aug 1, 2022 · 0 comments

Comments

@phihos
Copy link

phihos commented Aug 1, 2022

When having a lot of label combinations for a metric but only the metrics with large values are of interest (e.g. a url label) it might make sense to restrict the metrics presented by the HTTP server only to "topk" values with k being configurable on a per-metric basis. I think this only makes sense for gauges and counters.

I already looked up how it can be done and I am willing to implement it including tests. For that to work we need to introduce and own data store based on the default data store.
In it we would need to add a metric setting "topk" which makes all_metrics return just the top k metrics instead of all. If topk is not set all_metrics should return all metrics.
Finally we need to set that data store as default in the plugin code and add a topk option when initializing a metric.

Is that something you would consider accepting into your code base?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant