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

Refactor monitoring rules #1757

Merged
merged 5 commits into from Jan 23, 2024

Conversation

machadovilaca
Copy link
Member

What this PR does / why we need it:

Following the work started in kubevirt/kubevirt#10700, and according to the kubevirt/community#219 proposal, this PR refactors monitoring rules

jira-ticket: https://issues.redhat.com/browse/CNV-34289

Special notes for your reviewer:

Release note:

Refactor monitoring rules

@kubevirt-bot kubevirt-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels Jan 9, 2024
@@ -0,0 +1,101 @@
package main
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this file should be added for all operators?

Copy link
Member Author

Choose a reason for hiding this comment

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

here they already had the rules unit tests, on kubevirt they already had something similar, so it really depends

@@ -3,10 +3,11 @@ package main
import (
Copy link
Contributor

Choose a reason for hiding this comment

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

this file should move under pkg/monitoring/tools

Copy link
Member Author

Choose a reason for hiding this comment

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

Tools should be in the pkg/monitoring! Many component's Dockefiles when building the operator copy pkg/ into the final image, and it is not necessary for the final build, so it should be in a separate base directory like just tools/

Copy link
Contributor

Choose a reason for hiding this comment

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

In cdi we already moved the metrics tools under monitoring, and also I was able to move them in hco and hpp.
Basically it was Shirly's request so adding here @sradco

@@ -26,7 +26,6 @@ import (
"github.com/kubevirt/monitoring/pkg/metrics/parser"
Copy link
Contributor

Choose a reason for hiding this comment

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

this file should move under pkg/monitoring/tools

@@ -1,9 +1,10 @@
---
rule_files:
- /tmp/rules.verify.yaml
- /tmp/rules.verify
Copy link
Contributor

Choose a reason for hiding this comment

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

I think also this folder prom-rule-ci need to move under pkg/monitoring/tests or to to pkg/monitoring/tools

Copy link
Collaborator

@RamLavi RamLavi left a comment

Choose a reason for hiding this comment

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

Hey @machadovilaca - This PR lacks commit descriptions on all the commits. Please add these so I can review.

@@ -23,14 +23,14 @@ require (
github.com/openshift/origin v4.1.0+incompatible
github.com/operator-framework/operator-sdk v1.12.0
github.com/pkg/errors v0.9.1
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.64.1
Copy link
Collaborator

Choose a reason for hiding this comment

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

did you run make vendor afterwards, and add the necessary files?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, no additional changes

Update PrometheusRule generation approach
based on the changes proposed in
kubevirt/community#219

Signed-off-by: João Vilaça <jvilaca@redhat.com>
Simplify the collection of metrics
by using the utility methods added
in the previous commit

Signed-off-by: João Vilaça <jvilaca@redhat.com>
Add recording rules to the collector
that gathers and list all metrics
for the linter tool

Signed-off-by: João Vilaça <jvilaca@redhat.com>
Convert verify-rules to Golang
and take advantage of metrics and recording
rules listing utilities added in the previous
commits

Signed-off-by: João Vilaça <jvilaca@redhat.com>
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring
is no longer a indirect dependency, update go.mod
accordingly

Signed-off-by: João Vilaça <jvilaca@redhat.com>
Copy link

sonarcloud bot commented Jan 15, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@machadovilaca
Copy link
Member Author

/retest

Copy link
Collaborator

@RamLavi RamLavi left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Jan 23, 2024
@kubevirt-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RamLavi

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

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 23, 2024
@kubevirt-bot kubevirt-bot merged commit 4c51a0f into kubevirt:main Jan 23, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants