zio / zio-metrics-connectors

Monitoring, Metrics and Diagnostics for ZIO
https://zio.dev/zio-metrics-connectors
Apache License 2.0
30 stars 24 forks source link

Add metric filter, allow for label removal #61

Open erikvanoosten opened 10 months ago

erikvanoosten commented 10 months ago

Even though recording metrics is as good as free, unfortunately, publishing/collecting them is not. Small tweaks sometimes increase or decrease costs with a few thousand dollars per month. As libraries in the zio ecosystem adopt zio-metrics, more and more metrics will be recorded, even though some of these metrics will not be relevant for everybody.

To only publish/collect metrics that are needed, please allow for a metric filter.

Some cloud providers charge per metric (where a metric identification includes the labels). Therefore it would be great when the filter also allows for the removal of labels. This could be extended by allowing any change, including the name and measured value(s).

If this is already possible, documentation would be awesome!

calvinlfer commented 5 months ago

I think this problem needs to be fixed in core. We need a notion of disposable metrics that last for a specified duration before being garbage collected. We ran into a problem with this by using metrics with a lot of tags that are only used once or twice and never used again. The problem is there is currently no way to prune these metrics out. Just adding what we are experiencing