-
Notifications
You must be signed in to change notification settings - Fork 47
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
feat: Metrics unit tests #848
Conversation
Skipping CI for Draft Pull Request. |
/cc sradco |
70c6b44
to
b20b456
Compare
/cc sradco |
b20b456
to
eb05cb0
Compare
/cc sradco |
eb05cb0
to
1a4d50b
Compare
/cc sradco |
1a4d50b
to
92e129f
Compare
/cc sradco |
/retest |
1 similar comment
/retest |
92e129f
to
bda1ca6
Compare
/cc sradco |
bda1ca6
to
d98e42f
Compare
/cc sradco |
- interval: "1m" | ||
input_series: | ||
- series: 'kubevirt_ssp_template_validator_rejected_total{pod="virt-template-validator-12345"}' | ||
values: '0+1x10 10x120' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0+1x10 10
could work too, IIRC the last value is repeated indefinitely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here the change did not work. I'm not sure why, probably there is some interpolation and 0+1x10 10
evaluates to a different value at 65 min time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'a+bxn' becomes 'a a+b a+(2b) a+(3b) … a+(n*b)'
Read this as series starts at a, then n further samples incrementing by b.
Weird. Also, if the last value is repeated, then 0+1x10
could work as well. It could be about the increase
function in TemplateValidatorRejectedIncreaseQuery
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, probably.
Moved the definitions of alerts and rules to pkg/monitoring/rules package. Signed-off-by: Andrej Krejcir <[email protected]>
d98e42f
to
dbb7d3f
Compare
/cc sradco |
Added metrics unit tests file and a Makefile target to run the tests. Signed-off-by: Andrej Krejcir <[email protected]>
Added unit tests for all SSP alerts. Signed-off-by: Andrej Krejcir <[email protected]>
Made "recordRulesDescList" variable private. Signed-off-by: Andrej Krejcir <[email protected]>
dbb7d3f
to
36106a0
Compare
/cc sradco |
Quality Gate failedFailed conditions 18.9% Duplication on New Code (required ≤ 3%) |
/retest |
import ( | ||
"fmt" | ||
|
||
promv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: newline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I usually split the import
block into 3 parts:
- standard library
- imports from other modules defined in
go.mod
- imports from this project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 0xFelix The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Thanks @akrejcir! |
/cherry-pick release-v0.19 |
@akrejcir: #848 failed to apply on top of branch "release-v0.19":
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What this PR does / why we need it:
Added unit tests for prometheus metrics alerts.
Which issue(s) this PR fixes:
Fixes: https://issues.redhat.com/browse/CNV-29476
Release note: