Hi everyone, I made a custom exporter that outputs the cost of an instance for usage every 1h. Basically every 1h I get an integer ex. 20. I want to sum the upcoming integers, so. 1h - 20 2h - 20+20=40 3h - 40+20 = 60 etc.
This is my setup, how can I do that?
It can’t be done via Grafana transformations as far as I know, so the only way is to play with datasource.
Try to use max_over_time:
sum(max_over_time(baxi_cost_metric{cluster='$cluster'}[1d]))
or
max_over_time((baxi_cost_metric{cluster='$cluster'} and on() vector(time()) < $__from/1000)[${__range_s}s:$__interval])
Thanks for reply, I think the issue lays in the fact I made a Gauge metrics instead of Counter. Will modify the exporter itself.