Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Allow alert evaluation based on future data #16972

Closed
glindsay78 opened this issue May 9, 2019 · 8 comments
Closed

Allow alert evaluation based on future data #16972

glindsay78 opened this issue May 9, 2019 · 8 comments

Comments

@glindsay78
Copy link

What would you like to be added:
It would be nice if the alert engine was able evaluate rules using future data (e.g forecasts). Currently the query option only allows a time range from the past to now e.g query(A, 15m, now). Ideally it would allow 'now+X' queries e.g query(A, 15m, now+48h) or query(A, 15m, 48h).

Why is this needed:
To accommodate other (non sys-admin) data use cases for Grafana where forecast data is being displayed (e.g meterological) and alerts are requested based on this data, to allow warnings ahead of time rather than afterwards.
An example use case in shipping would be a wind forecast alert for a container crane so that if the wind forecasts are over a certain threshold, an alert is generated and operational impacts can be assessed.

Thanks for an awesome product!

@bergquist
Copy link
Contributor

Would make sense to add support for setting endtime in the future in Grafanas alerting. But I want to leave the forecasting to the datasource.

@glindsay78
Copy link
Author

Yep I agree, leave the forecasting to the experts.
"Prediction is very difficult, especially if it's about the future."

@Revilla2212
Copy link

+1

@glindsay78
Copy link
Author

Looking at the code and how the golang time.ParseDuration function works, you can actually achieve this in Grafana (since v5.2 anyway).
Set the from part to '0s' (e.g now) and then put in a future time duration string e.g '12h'.
e.g query(A, 0s, 12h)

image

@Revilla2212
Copy link

Thanks for the info!

I tested it but in my case (influxdb and predicting with holt winters) that returned a "no data" state.
But, I did more testing and it worked for me using this query:
imatge

The 5h is because I specify holt winters to start predicting with the data of 5h ago.

@lihan
Copy link

lihan commented Jun 29, 2019

Is there a way to pull data out of Grafana rather than the actual data source?

The reason is that this way, the prediction server only have to integrate with Grafana once and works with all data sources, otherwise have to integrate with every data source. (Prometheus, SQL, CloudWatch etc..)

#17834

@lessenko
Copy link

+1

@janwadebock
Copy link

I am trying this in v6.2.5 but can't get this to work.
Forecasted data of the high and low tide is entered in influx with future dates (max 48h in advance)
So would like to fire an alert when the tide will rise a given height in the near future (and not when the tide is already at this height)
When using the method as suggested glindsay78, I am always getting no data and so condition is not going to true.
Also not sure I understand solution from Revilla2212: I understood this would check data from now (0s) to 5 hours earlier. Not sure how this can be forecasted data. Anyway, in my case that did not work either.

Any suggestions ?

@grafana grafana locked and limited conversation to collaborators Jul 20, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

7 participants