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

Add min/max/first selector for alerts #7076

Merged
merged 3 commits into from
Aug 1, 2024

Conversation

ezraodio1
Copy link
Contributor

What type of PR is this?

  • Feature

Description

This feature allows the user to create an alert that checks the minimum, maximum, or first value of a column when evaluating.

Currently, alerts will only check the first value of a column when evaluating.

This change makes alerts more useful and allows users to set up new kinds of conditions to test for.

How is this tested?

  • Unit tests (pytest, jest)
  • E2E Tests (Cypress)
  • Manually
  • N/A

Related Tickets & Documents

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

Screenshot 2024-07-24 at 3 17 51 PM

@eradman
Copy link
Collaborator

eradman commented Jul 29, 2024

Very nice feature!

We should also add a new variable called ALERT_SELECTOR so that this option can be rendered in an alert email template.

See render_template() at

context = {
"ALERT_NAME": self.name,
"ALERT_URL": "{host}/alerts/{alert_id}".format(host=host, alert_id=self.id),
"ALERT_STATUS": self.state.upper(),
"ALERT_CONDITION": self.options["op"],
"ALERT_THRESHOLD": self.options["value"],
"QUERY_NAME": self.query_rel.name,
"QUERY_URL": "{host}/queries/{query_id}".format(host=host, query_id=self.query_rel.id),
"QUERY_RESULT_VALUE": result_value,

@ezraodio1
Copy link
Contributor Author

rendered in an alert email template

Very nice feature!

We should also add a new variable called ALERT_SELECTOR so that this option can be rendered in an alert email template.

See render_template() at

context = {
"ALERT_NAME": self.name,
"ALERT_URL": "{host}/alerts/{alert_id}".format(host=host, alert_id=self.id),
"ALERT_STATUS": self.state.upper(),
"ALERT_CONDITION": self.options["op"],
"ALERT_THRESHOLD": self.options["value"],
"QUERY_NAME": self.query_rel.name,
"QUERY_URL": "{host}/queries/{query_id}".format(host=host, query_id=self.query_rel.id),
"QUERY_RESULT_VALUE": result_value,

Good call. Just added the selector to the template.

@ezraodio1 ezraodio1 force-pushed the new-alert-conditions branch from 153a560 to ee5e9b5 Compare July 31, 2024 14:31
@ezraodio1 ezraodio1 force-pushed the new-alert-conditions branch from ee5e9b5 to 1439797 Compare July 31, 2024 19:47
@eradman eradman force-pushed the new-alert-conditions branch from 1439797 to cf69691 Compare August 1, 2024 13:57
@eradman eradman enabled auto-merge (squash) August 1, 2024 13:58
@eradman eradman merged commit fc1e1f7 into getredash:master Aug 1, 2024
11 checks passed
harveyrendell pushed a commit to pushpay/redash that referenced this pull request Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants