fluent / fluent/fluent-plugin-prometheus
Expose only topk metrics to Prometheus
- Dominant language
- Ruby
- Stars
- 257
- Forks
- 83
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 7
Description
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](https://github.com/prometheus/client_ruby#data-stores) based on the [default data store](https://github.com/prometheus/client_ruby/blob/main/lib/prometheus/client/data_stores/synchronized.rb).
In it we would need to add a metric setting "topk" which makes [`all_metrics`](https://github.com/prometheus/client_ruby/blob/main/lib/prometheus/client/data_stores/synchronized.rb#L53) 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?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.