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

Expressions/threshold: Fix incorrect thresholds args length #66859

Merged
merged 4 commits into from Apr 20, 2023

Conversation

gillesdemey
Copy link
Member

@gillesdemey gillesdemey commented Apr 19, 2023

What is this feature?

When using a threshold expression with fewer than the required number of args, it would panic because it accessed a non-existing index of the slice.

Why do we need this feature?

This fix returns a sensible error and does not dump a stack trace to the logs.

Special notes for your reviewer:

Steps to reproduce

  1. Create a new alert (default settings are fine)
  2. Change threshold to "is within range" and don't fill anything in
  3. Press "preview".

@gillesdemey gillesdemey added type/bug area/alerting Grafana Alerting area/backend add to changelog area/expressions Server Side Expressions (SSE) backport v9.4.x Mark PR for automatic backport to v9.4.x backport v9.5.x Bot will automatically open backport PR labels Apr 19, 2023
@gillesdemey gillesdemey added this to the 9.5.1 milestone Apr 19, 2023
@gillesdemey gillesdemey requested a review from a team April 19, 2023 13:59
@gillesdemey gillesdemey requested a review from a team as a code owner April 19, 2023 13:59
Copy link
Contributor

@yuri-tceretian yuri-tceretian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Overlaps with other testcases
@gillesdemey gillesdemey enabled auto-merge (squash) April 19, 2023 22:02
@gillesdemey gillesdemey merged commit 350de3f into main Apr 20, 2023
10 checks passed
@gillesdemey gillesdemey deleted the alerting/fix-thresholds-args-nil branch April 20, 2023 09:42
grafanabot pushed a commit that referenced this pull request Apr 20, 2023
grafanabot pushed a commit that referenced this pull request Apr 20, 2023
@zerok zerok modified the milestones: 9.5.1, 10.0.0 Apr 20, 2023
gillesdemey added a commit that referenced this pull request Apr 20, 2023
…66926)

Expressions/threshold: Fix incorrect thresholds args length (#66859)

(cherry picked from commit 350de3f)

Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
gillesdemey added a commit that referenced this pull request Apr 20, 2023
…66925)

Expressions/threshold: Fix incorrect thresholds args length (#66859)

(cherry picked from commit 350de3f)

Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
@zerok zerok modified the milestones: 10.0.0, 10.0.0-preview May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add to changelog area/alerting Grafana Alerting area/backend area/expressions Server Side Expressions (SSE) backport v9.4.x Mark PR for automatic backport to v9.4.x backport v9.5.x Bot will automatically open backport PR type/bug
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants