-
Notifications
You must be signed in to change notification settings - Fork 184
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
Refactoring of 'replaceToken' code which changes PrometheusRules #2822
base: main
Are you sure you want to change the base?
Refactoring of 'replaceToken' code which changes PrometheusRules #2822
Conversation
2dae404
to
3623839
Compare
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.
The initial idea of not specifying rule names for the osd/cluster utilization numbers was due to the fact that they were being changed across multiple rules, and we wanted the value to be replaced in all the rules. So if we want to cover it with particular rules we have to be careful to cover them in all the rules they appear.
createReplaceToken("", "", "0.75", fmt.Sprintf("%f", *specifiedNearFullRatio))) | ||
createReplaceToken("cluster-utilization-alert.rules", "CephClusterNearFull", | ||
"75%", fmt.Sprintf("%0.0f%%", *specifiedNearFullRatio*100), AnnotationRuleSection, DescriptionKey), | ||
createReplaceToken("cluster-utilization-alert.rules", "CephClusterNearFull", |
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.
75 % & 0.75 needs to be replaced in CephClusterNearFull & CephOSDNearFull both
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.
For CephOSDNearFull
alert , are we replacing it with same *specifiedNearFullRatio
value?
Or do we have to add a separate set of fields under ManageCephCluster
struct (similar to the fields we currently added like NearFullRatio
, BackfillFullRatio
and FullRatio
)?
createReplaceToken("", "", "80%", fmt.Sprintf("%.2f%%", *specifiedBackfillFullRatio*100)), | ||
createReplaceToken("", "", "0.80", fmt.Sprintf("%f", *specifiedBackfillFullRatio))) | ||
createReplaceToken("cluster-utilization-alert.rules", "CephClusterCriticallyFull", | ||
"80%", fmt.Sprintf("%0.0f%%", *specifiedBackfillFullRatio*100), AnnotationRuleSection, DescriptionKey), |
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.
80%/0.80 needs to replaced in CephClusterCriticallyFull & CephOSDCriticallyFull.
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.
Same question as above, but regarding CephOSDCriticallyFull
alert, are we going to use the same *BackfillFullRatio
value or create new fields for CephOSD* alerts?
createReplaceToken("", "", "85%", fmt.Sprintf("%.2f%%", *specifiedFullRatio*100)), | ||
createReplaceToken("", "", "0.85", fmt.Sprintf("%f", *specifiedFullRatio))) | ||
createReplaceToken("cluster-utilization-alert.rules", "CephClusterReadOnly", | ||
"85%", fmt.Sprintf("%0.0f%%", *specifiedFullRatio*100), AnnotationRuleSection, DescriptionKey), |
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.
85% needs to be replaced in CephClusterNearFull, CephClusterCriticallyFull, CephClusterReadOnly
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.
Done
Added more details to 'replaceToken' struct which give more details about where the change is going to be reflected in the rule. Added usecases to tests. Signed-off-by: Arun Kumar Mohan <[email protected]>
3623839
to
2d5b8cc
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: aruniiird The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Added more details to 'replaceToken' struct which give more details about where the change is going to be reflected in the rule. Added more usecases to tests.