Skip to content

Add min/max/first selector for alerts#7076

Merged
eradman merged 3 commits intogetredash:masterfrom
ezraodio1:new-alert-conditions
Aug 1, 2024
Merged

Add min/max/first selector for alerts#7076
eradman merged 3 commits intogetredash:masterfrom
ezraodio1:new-alert-conditions

Conversation

@ezraodio1
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
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