discourse / prometheus_exporter

A framework for collecting and aggregating prometheus metrics
MIT License
538 stars 156 forks source link

FIX: Memory leaks in unicorn + puma collectors #276

Closed adamk9k closed 1 year ago

adamk9k commented 1 year ago

This cherry-picks an old commit that somehow got removed/overwritten. See related discussion at: https://github.com/discourse/prometheus_exporter/issues/275

SamSaffron commented 1 year ago

wait I am confused...

@puma_metrics = MetricsContainer.new

Doesn't MetricsContainer by @sosedoff solve this problem? It is already implemented.

sosedoff commented 1 year ago

MetricsContainer uses a default expiry of 60s, i think i forgot to include the usage of the puma metrics ttl constant in the PR, but i do have this addressed in the WIP PR #268.

So, yeah, any collector that uses the metrics container should be able to expire old data points.

adamk9k commented 1 year ago

Thanks, good to know. I'll close this one then.