prom-client
prom-client copied to clipboard
[Question] Deserialize metrics from the file
Hi, in my app I don't use any kind of DB, but I want to serialize metrics to the file using getMetricsAsJSON
every minute or after each event. Then in case I need to release a new version or restart my app I want read data from the file and continue count metrics. I found that I can use registerMetric
and pass instance of Counter/Gauge/etc class but not the data from the file right away. Any elegant way I can de-serialize data on restart? Or the only option I have is read from the file, loop through the data and create instances and push them to registerMetric
?
Thank you
There's indeed no way to do this current, and it sounds out of scope. Does pushGateway + using rates instead of absolute counts address your use case?
I decided to revamp my app and to add db as well. So no longer a case, thank you