fix: use better value for threshold value in alert description #5844
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 assum(values...)
✅OnAverage
: the observed metric value computed asavg(values...)
✅AtleastOnce
: the observed metric value computed is whichever is the first value that meets the conditionExample:
ValueIsAbove
: any value (usually the first ordered by ts desc) in series > thresholdValueIsBelow
: any value (usually the first ordered by ts desc) in series < thresholdValueIsEq
: any value (usually the first ordered by ts desc) in series = thresholdValueIsNotEq
: any value (usually the first ordered by ts desc) in series != thresholdHowever, the current logic for
AllTheTimes
uses thetargetVal
which doesn't give a good idea of the observed metric valuesignoz/pkg/query-service/rules/threshold_rule.go
Line 1200 in 709c286
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 valuesValueIsBelow
: since we can't show multiple values in the description, we use the max among the series valuesValueIsEq
: nothing needs to changeValueIsNotEq
: any non-inf or nan value from the series