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 common component metrics #11184
Refactor common component metrics #11184
Conversation
/cc @enp0s3 |
b40b83f
to
8615658
Compare
/test pull-kubevirt-e2e-k8s-1.29-sig-monitoring |
8615658
to
8b2440d
Compare
/test pull-kubevirt-e2e-k8s-1.29-sig-monitoring |
8b2440d
to
051bcff
Compare
/test pull-kubevirt-e2e-k8s-1.29-sig-monitoring |
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.
@machadovilaca Hi, thanks for the PR, looks good.
I saw that you've added new files, can you please change the naming style to snake case instead of camel case? its for consistency.
@@ -184,6 +172,31 @@ func getMetricsNotIncludeInEndpointByDefault() metricList { | |||
return metrics | |||
} | |||
|
|||
func getVirtControllerMetrics() metricList { | |||
err := virt_controller.SetupMetrics(nil, nil, nil, nil, nil, nil, nil, nil) | |||
checkError(err) |
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.
checkError
is really redundant, it doesn't to the coding style IMO, there is no added value in calling a dedicated function for that.
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.
it was previously done in this script, do you think I can/makes sense to edit the whole file and remove the checkError
s?
@@ -33,7 +33,10 @@ import ( | |||
// https://sdk.operatorframework.io/docs/best-practices/observability-best-practices/#metrics-guidelines | |||
// should be ignored. | |||
var excludedMetrics = map[string]struct{}{ | |||
"kubevirt_vmi_phase_count": struct{}{}, | |||
"kubevirt_vmi_phase_count": {}, |
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.
Why do you want to ignore them?
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.
this collector is used by the linter, and these metrics do not follow the naming conventions, that's why I'm excluding them from the linter, while we don't refactor them
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.
maybe worth changing the names to start with kubevirt_?
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.
I agree we need to do so, but I don't think it should be as part of this PR
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.
@machadovilaca Please add kubevirt_
prefix to all the metrics.
You already added reflector_
to the reflector metrics.
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.
I'm avoiding renaming any metrics as part of this PRs
reflector was already part of the metrics names through the 'subsytem':
const reflectorSubsystem = "reflector" |
I'm also avoiding using the subsystem method because of this, IMO it makes it harder to find metrics by name and it is easier to generate confusion
051bcff
to
69c35a5
Compare
/test pull-kubevirt-e2e-k8s-1.29-sig-monitoring |
@enp0s3 updated |
69c35a5
to
f375f84
Compare
f375f84
to
55031cb
Compare
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: acardace 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 |
Required labels detected, running phase 2 presubmits: |
/retest-required |
5 similar comments
/retest-required |
/retest-required |
/retest-required |
/retest-required |
/retest-required |
/hold |
Signed-off-by: João Vilaça <jvilaca@redhat.com>
55031cb
to
8552eb1
Compare
fails due to the merge of #11307 the method in controller-runtime was later removed in kubernetes-sigs/controller-runtime#1946, which doesn't affect KubeVirt yet |
Reflector metrics were removed in Kubernetes due to them causing memory leaks: kubernetes/kubernetes#74636 Signed-off-by: João Vilaça <jvilaca@redhat.com>
Signed-off-by: João Vilaça <jvilaca@redhat.com>
8552eb1
to
58fb25a
Compare
/test pull-kubevirt-unit-test-arm64 |
/lgtm |
Required labels detected, running phase 2 presubmits: |
/unhold |
@machadovilaca: The following test failed, say
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. I understand the commands that are listed here. |
/retest-required |
What this PR does
Before this PR:
Old metric implementation style for client, workqueue and reflector metrics
After this PR:
According to kubevirt/community#219, refactor client, workqueue and reflector metrics to follow new approach
jira-ticket: https://issues.redhat.com/browse/CNV-27306
jira-ticket: https://issues.redhat.com/browse/CNV-38135
jira-ticket: https://issues.redhat.com/browse/CNV-38136
Fixes #
Why we need it and why it was done in this way
The following tradeoffs were made:
The following alternatives were considered:
Links to places where the discussion took place:
Special notes for your reviewer
Checklist
This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR.
Approvers are expected to review this list.
Release note