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

fix: use better value for threshold value in alert description #5844

Merged
merged 3 commits into from
Sep 4, 2024

Conversation

srikanthccv
Copy link
Member

Summary

The alert sends a description, the threshold is set to X, and the observed metric value is Y

If the condition match type is

  • InTotal: the observed metric value computed as sum(values...)
  • OnAverage: the observed metric value computed as avg(values...)
  • AtleastOnce: the observed metric value computed is whichever is the first value that meets the condition
    Example:
    • ValueIsAbove: any value (usually the first ordered by ts desc) in series > threshold
    • ValueIsBelow: any value (usually the first ordered by ts desc) in series < threshold
    • ValueIsEq: any value (usually the first ordered by ts desc) in series = threshold
    • ValueIsNotEq: any value (usually the first ordered by ts desc) in series != threshold

However, the current logic for AllTheTimes uses the targetVal which doesn't give a good idea of the observed metric value

alertSmpl = Sample{Point: Point{V: r.targetVal()}, Metric: lblsNormalized, MetricOrig: lbls}

This change updates the value to use in the description.

When:

  • ValueIsAbove: since we can't show multiple values in the description, we use the min among the series values
  • ValueIsBelow: since we can't show multiple values in the description, we use the max among the series values
  • ValueIsEq: nothing needs to change
  • ValueIsNotEq: any non-inf or nan value from the series

@github-actions github-actions bot added the bug Something isn't working label Sep 3, 2024
Copy link

github-actions bot commented Sep 3, 2024

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@srikanthccv srikanthccv marked this pull request as ready for review September 4, 2024 07:06
pkg/query-service/rules/prom_rule.go Show resolved Hide resolved
pkg/query-service/rules/prom_rule.go Outdated Show resolved Hide resolved
@srikanthccv srikanthccv merged commit 6019b38 into develop Sep 4, 2024
12 checks passed
@srikanthccv srikanthccv deleted the fix-value-in-alert branch September 4, 2024 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants