zapier / prom-aggregation-gateway

An aggregating push gateway for Prometheus
Mozilla Public License 2.0
116 stars 26 forks source link

feature → setting ttl to clean up old metrics #87

Open xamaterasux opened 2 months ago

xamaterasux commented 2 months ago

Hello,

Pushing metrics from batch scripts makes memory (RSS) increase over time. Could it be created a way to clean these metrics after a defined time (ttl) instead of getting this service restarted to free this memory?


I've seen in the old project they had the idea of implementing so:

Inspecting metrics/aggregate.go I see a function:

44 func SetTTLMetricTime(duration *time.Duration) aggregateOptionsFunc {
 45     return func(a *Aggregate) {
 46         a.options.metricTTLDuration = duration
 47     }
 48 }

I think this is not being used, but I also don't know if this could be used. At the begining I thought I could set a value for this, but after searching for this function over the files I could not find a place where it was being used.

Thank you!