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

custom metric state - could we keep it on disk? #562

Open
RichardWright opened this issue Mar 28, 2023 · 2 comments
Open

custom metric state - could we keep it on disk? #562

RichardWright opened this issue Mar 28, 2023 · 2 comments

Comments

@RichardWright
Copy link

We rely alot on metrics and the share of memory that prometheus uses is growing. Has it ever been suggested that counters/gauges could write to disk and retrieve that state for scraping?

Thanks for the great lib btw. We've recently moved off open telemetry and really appreciate the flexibility of the prom-client api, setting gauges is a great feature.

@shappir
Copy link
Contributor

shappir commented Apr 4, 2023

Saving to disk will make updating entires much more expensive - I don't think it's a viable approach in this case.

I would recommend looking at ways to reduce the cardinality of your data, especially histograms: reduce the number of labels, label value permutations, buckets.

There are ways in which the library itself could be improved, e.g. currently each histogram entry contains a dictionary of its label values, which is essentially a duplication of the data used as entry index key. A more memory efficient data structure could be used instead.

@RichardWright
Copy link
Author

We gave up on histograms a while ago.

Memory efficieny would be appreciated. We have quite high cardinality as we run stateful, long lived, socket based applications and use the metrics as a way of shipping that state. Ideally we wouldn't, but an alternative pattern isn't obvious.

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

No branches or pull requests

2 participants