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

Add support for keep_firing_for in the parser #713

Merged
merged 3 commits into from
Sep 11, 2023

Conversation

felipesere
Copy link
Contributor

This has been merged into Prometheus, Prometheus Operator and is close to done in Thanos.

@prymitive
Copy link
Collaborator

Thanks.
Since this affects how long alerts fire and resolve alerts/count check will need to be updated to take it into account, like we do with for - https://github.com/cloudflare/pint/blob/main/internal/checks/alerts_count.go#L95

@codecov-commenter
Copy link

codecov-commenter commented Sep 8, 2023

Codecov Report

Merging #713 (23fabc4) into main (3e218f6) will increase coverage by 0.27%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #713      +/-   ##
==========================================
+ Coverage   93.63%   93.90%   +0.27%     
==========================================
  Files          85       85              
  Lines        8123     8193      +70     
==========================================
+ Hits         7606     7694      +88     
+ Misses        396      380      -16     
+ Partials      121      119       -2     
Files Changed Coverage Δ
internal/checks/alerts_count.go 100.00% <100.00%> (ø)
internal/checks/alerts_for.go 100.00% <100.00%> (ø)
internal/checks/rule_for.go 100.00% <100.00%> (ø)
internal/config/for.go 96.87% <100.00%> (+1.22%) ⬆️
internal/config/match.go 99.41% <100.00%> (+0.03%) ⬆️
internal/config/rule.go 100.00% <100.00%> (ø)
internal/parser/models.go 91.11% <100.00%> (+5.56%) ⬆️
internal/parser/parser.go 91.72% <100.00%> (+0.20%) ⬆️

@felipesere
Copy link
Contributor Author

I'm not sure how to exactly account for keep_firing_for. Does the AlertCount check verify how many "up-flanks" there were - i.e. change from pending to firing?
I wonder if I need to make we don't count any ranges that fall within keep_firing_for of an already counted alert?

@prymitive
Copy link
Collaborator

I'm not sure how to exactly account for keep_firing_for. Does the AlertCount check verify how many "up-flanks" there were - i.e. change from pending to firing? I wonder if I need to make we don't count any ranges that fall within keep_firing_for of an already counted alert?

It simply walks over samples from Prometheus range query response.
This needs a lot more changes than just parsing, so I'll add tests for this in alerts/count + add the rest of needed changes.

@prymitive
Copy link
Collaborator

prymitive commented Sep 11, 2023

  • alerts/count
  • alerts/for
  • rule/for
  • config match

@prymitive prymitive merged commit 2b18d18 into cloudflare:main Sep 11, 2023
17 of 18 checks passed
@felipesere felipesere deleted the support-keep-firing-for branch September 11, 2023 12:43
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