digitalocean / prometheus-client-c

A Prometheus Client in C
Other
160 stars 79 forks source link

Is it possible to open new API to clear data? #48

Open yuanchieh-cheng opened 3 years ago

yuanchieh-cheng commented 3 years ago

After run prometheus client for a long time, the memory keep eating up.
It would be better if I could simply call a api to flush all the collected data.
Is it possible or any better solution to prevent out of memory trouble?

miroswan commented 3 years ago

There is not. Based on the test coverage that exists currently, there are no memory leaks; we maintain a suite of tests that check for these in CI. However, that doesn't necessarily mean there is not a possible memory leak in places where the library is not tested. I believe the best path forward it to improve the test coverage such that we can prove with absolute certainty that no leaks exists. Until then, please be diligent about using tools like Valgrind to determine where your memory issues might exist.

yuanchieh-cheng commented 3 years ago

Sorry for my bad description.
I think this it not memory leak issue. The memory keep eating up just because there is no way to clear the data and the memory would ultimately run out.
Or is there any memory control mechanism inside the library ? What will happen if I keep add metrics data ?

When I read the prometheus documentation, I could set the expiration time or max storage size to prevent the memory or disk full issue.
That's why I ask for exposing a API to clear the data.

Actually I came from this issue https://github.com/coturn/coturn/issues/666

batusekerci commented 1 year ago

Sorry for my bad description. I think this it not memory leak issue. The memory keep eating up just because there is no way to clear the data and the memory would ultimately run out. Or is there any memory control mechanism inside the library ? What will happen if I keep add metrics data ?

When I read the prometheus documentation, I could set the expiration time or max storage size to prevent the memory or disk full issue. That's why I ask for exposing a API to clear the data.

Actually I came from this issue coturn/coturn#666

Could you please explain, how did you solve this issue?