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

Refactoring of 'replaceToken' code which changes PrometheusRules #2822

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aruniiird
Copy link
Contributor

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.

@aruniiird aruniiird force-pushed the refactor-prometheusrule-replaceToken-code branch 3 times, most recently from 2dae404 to 3623839 Compare September 27, 2024 06:46
Copy link
Contributor

@malayparida2000 malayparida2000 left a 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",
Copy link
Contributor

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

Copy link
Contributor Author

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),
Copy link
Contributor

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.

Copy link
Contributor Author

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),
Copy link
Contributor

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

Copy link
Contributor Author

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]>
@aruniiird aruniiird force-pushed the refactor-prometheusrule-replaceToken-code branch from 3623839 to 2d5b8cc Compare December 12, 2024 12:59
Copy link
Contributor

openshift-ci bot commented Dec 12, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: aruniiird
Once this PR has been reviewed and has the lgtm label, please assign blaineexe for approval. For more information see the Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

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.

2 participants