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

Memory leak #52

Open
yzh44yzh opened this issue Sep 26, 2022 · 3 comments
Open

Memory leak #52

yzh44yzh opened this issue Sep 26, 2022 · 3 comments

Comments

@yzh44yzh
Copy link

Hi. We are using your library in our project, and consider it helpful. Thank you.

However, we found a memory leak. If nobody ever asks for metrics through API, ETS dist table is never clean up.

We've got 1Gb of data and 3M of records in dist table before noticing it.

@yzh44yzh
Copy link
Author

yzh44yzh commented Sep 26, 2022

https://github.com/beam-telemetry/telemetry_metrics_prometheus_core/blob/main/lib/core/aggregator.ex#L17
this is where data are removed from table. If nobody calls Aggregator.aggregate/3, data are never removed.

@akoutmos
Copy link
Contributor

akoutmos commented Oct 9, 2022

There are a couple of ways to solve this problem. Some of those have been discussed here: #41.

In short, you will probably need to set up a GenServer cron job that regularly aggregates the ETS data.

@yzh44yzh
Copy link
Author

yzh44yzh commented Oct 9, 2022

Ok, thank you. As for me, I've replaced this lib with prometheus_ex.

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

No branches or pull requests

2 participants