Skip to content

Grafana

Allex edited this page Dec 10, 2024 · 1 revision

predict_linear

Predict 7days into the future, correcting the graph to align with the actual value

predict_linear(sum(increase(pyoci_uptime_seconds_total[30d] offset 7d))[30d:],7d)

  • pyoci_uptime_seconds_total[30d] offset 7d: select data for the past 30 days, then shift it forward (right) 7 days
  • sum(increase(<>)): sum the increase of all datasets
  • [30d:]: select a 30 day long range with automatic resolution to pass to predict_linear
  • predict_linear(<>, 7d): predict 7 days into the future

The offset 7d overlaps the predicted value with the actual value at the predicted time if you would plot both in the same graph.

Omit the offset for instant queries where you are interested in the predicted value 7d from now.

Clone this wiki locally