Skip to content
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

Unable to setup alerts based on expression #38578

Closed
iamyogeshg opened this issue Aug 26, 2021 · 4 comments
Closed

Unable to setup alerts based on expression #38578

iamyogeshg opened this issue Aug 26, 2021 · 4 comments

Comments

@iamyogeshg
Copy link

@kylebrandt I am trying to setup alerts based on exact same use case as OP (#31471), however I can't still setup alerts on Math expression and it shows error as can be seen in screenshot:
image

Now if i try to setup alert on reduced expression D, it seems to be not throwing any error, however I am not certain if this is correct way to configure for this use case. Any help would be highly appreciated. Thanks!

Originally posted by @iamyogeshg in #31471 (comment)

@kylebrandt
Copy link
Contributor

Alerting works on numbers and not time series type data. So if $A and $B are time series data, that math expression will also provide time series data. So reducing is required like when you select $D.

The other option, depending on your data and logic, is to reduce $A and $B with additional operations, and then use math operation on those reduced inputs. Then the math operation will output numbers instead of time series and can be selected as the condition.

@iamyogeshg
Copy link
Author

Thanks @kylebrandt.

@hlior
Copy link

hlior commented Feb 22, 2023

the reduce didn't work for me.
i use a new query that in it i reduce a from b in one line:

(sum by (projectId) (rate(events_total{projectId='XXX'}[5m]))) - (sum by (projectId) (rate(events_total{projectId='XXX'}[24h])))

@Richard-Payne
Copy link

Richard-Payne commented May 30, 2023

@kylebrandt I'm not sure I follow your comment there.

If I create a query from my Cloudwatch database like this:

SELECT SUM(BlockedRequests) FROM "AWS/WAFV2"

I get a time series plot. I can configure an alert on this expression.
But if I then add an math Expression which is simply this:

$A

I still get a time series plot, and I can still configure an alert.

However, if I add a second query:

SELECT SUM(CountedRequests) FROM "AWS/WAFV2"

and a math expression:

100*($A/$B)

And try to alert on the expression then I get an error:

The datasource does not support alerting queries

Expression C still visualises as a time series.

Could you explain how what you were saying about time series/numbers in relation to alerting applies here? Could you, or anyone else, give some guidance on how to accomplish alerting on one time series as a percentage of another?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants