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

app/vmalert: detect alerting rules which don't match any series at all #4198

Merged
merged 3 commits into from May 8, 2023

Conversation

hagen1778
Copy link
Collaborator

@hagen1778 hagen1778 commented Apr 25, 2023

vmalert starts to understand /query responses which contain object:

"stats":{"seriesFetched": "42"}

If object is present, vmalert parses it and populates a new field SeriesFetched. This field is then used to populate the new metric vmalert_alerting_rules_last_evaluation_series_fetched and to display warnings in the vmalert's UI.

If response doesn't contain the new object (Prometheus or VictoriaMetrics earlier than v1.90), then SeriesFetched=nil. In this case, UI will contain no additional warnings. And vmalert_alerting_rules_last_evaluation_series_fetched will be set to -1. Negative value of the metric will help to compile correct alerting rule in follow-up.

Thanks for the initial implementation to @Haleygo
See #4056

See #4039


image

image

image

@hagen1778 hagen1778 marked this pull request as ready for review April 26, 2023 09:30
Copy link
Contributor

@f41gh7 f41gh7 left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov
Copy link

codecov bot commented Apr 26, 2023

Codecov Report

Patch coverage: 65.49% and project coverage change: -0.03 ⚠️

Comparison is base (4e71003) 61.27% compared to head (7a12db7) 61.25%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4198      +/-   ##
==========================================
- Coverage   61.27%   61.25%   -0.03%     
==========================================
  Files         329      329              
  Lines       58927    58992      +65     
==========================================
+ Hits        36109    36134      +25     
- Misses      20843    20880      +37     
- Partials     1975     1978       +3     
Impacted Files Coverage Δ
app/vmalert/datasource/datasource.go 83.33% <ø> (ø)
app/vmalert/rule.go 100.00% <ø> (ø)
app/vmalert/web_types.go 100.00% <ø> (ø)
app/vmalert/web.qtpl 72.72% <34.14%> (-3.40%) ⬇️
app/vmalert/datasource/vm.go 81.35% <60.00%> (ø)
app/vmalert/datasource/vm_prom_api.go 79.72% <64.00%> (-2.59%) ⬇️
app/vmalert/datasource/vm_graphite_api.go 81.81% <66.66%> (ø)
app/vmalert/alerting.go 77.17% <80.00%> (-0.89%) ⬇️
app/vmalert/recording.go 79.48% <100.00%> (+0.40%) ⬆️

... and 5 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

docs/README.md Outdated Show resolved Hide resolved
vmalert starts to understand /query responses which contain object:
```
"stats":{"seriesFetched": "42"}
```
If object is present, vmalert parses it and populates a new field
`SeriesFetched`. This field is then used to populate the new metric
`vmalert_alerting_rules_last_evaluation_series_fetched` and to
display warnings in the vmalert's UI.

If response doesn't contain the new object (Prometheus or
VictoriaMetrics earlier than v1.90), then `SeriesFetched=nil`.
In this case, UI will contain no additional warnings.
And `vmalert_alerting_rules_last_evaluation_series_fetched` will
be set to `-1`. Negative value of the metric will help to compile
correct alerting rule in follow-up.

Thanks for the initial implementation to @Haleygo
See #4056

See #4039

Signed-off-by: hagen1778 <roman@victoriametrics.com>
Signed-off-by: hagen1778 <roman@victoriametrics.com>
Signed-off-by: hagen1778 <roman@victoriametrics.com>
@hagen1778 hagen1778 merged commit 5b8450f into master May 8, 2023
9 of 10 checks passed
@hagen1778 hagen1778 deleted the vmalert-check-stats branch May 8, 2023 07:36
valyala pushed a commit that referenced this pull request May 10, 2023
#4198)

app/vmalert: detect alerting rules which don't match any series at all

vmalert starts to understand /query responses which contain object:
```
"stats":{"seriesFetched": "42"}
```
If object is present, vmalert parses it and populates a new field
`SeriesFetched`. This field is then used to populate the new metric
`vmalert_alerting_rules_last_evaluation_series_fetched` and to
display warnings in the vmalert's UI.

If response doesn't contain the new object (Prometheus or
VictoriaMetrics earlier than v1.90), then `SeriesFetched=nil`.
In this case, UI will contain no additional warnings.
And `vmalert_alerting_rules_last_evaluation_series_fetched` will
be set to `-1`. Negative value of the metric will help to compile
correct alerting rule in follow-up.

Thanks for the initial implementation to @Haleygo
See #4056

See #4039

Signed-off-by: hagen1778 <roman@victoriametrics.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants