Hello,
I have data that always increments and that looks like a counter. Each point is the last value + the increment.
Example:
I want to add 5 on each point.
My points should look like this: 0; 5; 10; 15; 20; 25 …
Prometheus counter would typically look like a good tool for my case, but I couldn’t find the influx equivalent.
I currently thought about 3 solutions.
-
Cache
Solution: Use a cache, that I initialise with the last value, and that I use to know the value to add in the DB.
Drawback: The cache is a Single Point of Failure and I would prefer avoiding such a hard reliance on cache. -
No longer use counter when writing
Solution: Only write the actual value in the Database and not the cumulative. I would then have to calculate the sum at read.
Drawback: This seems expensive, especially as the amount of data grows. Since I would need to visualise data over a random period of time, that would also mean a lot of calculation. -
Query on every Write
Solution: When writing data, I could query the last value each time to increment and then write the correct data in the Database.
Drawback: This seems expensive at each request. I also wonder if it would have any issue with influxDB batching requests…
None of theses solutions seems optimal, but I might be wrong in my reasoning regarding the approach overall or the drawbacks of each solution.