Skip to content

Conversation

@sradco
Copy link

@sradco sradco commented Jan 1, 2026

What this PR does / why we need it:
Updated the
kube_application_aware_resourcequota_creation_timestamp metric name to
kube_application_aware_resourcequota_creation_timestamp_seconds to meet the Prometheus naming conventions
and added a recording rule for backwards compatability.

The PR also adds the prometheus unit tests, the metrics naming linter and the docs generator, like we have the the rest of the kubevirt operators.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

Release note:

Update kube_application_aware_resourcequota_creation_timestamp metric name to
kube_application_aware_resourcequota_creation_timestamp_seconds to meet the Prometheus naming conventions.

@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 1, 2026
@sradco
Copy link
Author

sradco commented Jan 1, 2026

@Barakmor1 please review this PR

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@sradco sradco force-pushed the update_metric_name branch from 1285076 to 4115dbe Compare January 1, 2026 11:34
@sradco sradco force-pushed the update_metric_name branch 2 times, most recently from c39ed92 to cff3f10 Compare January 1, 2026 12:37
@sradco sradco force-pushed the update_metric_name branch 5 times, most recently from d523c29 to 6dbda3f Compare January 1, 2026 23:52
@Barakmor1
Copy link
Member

Barakmor1 commented Jan 4, 2026

Thanks for this work. At first glance, it looks like many different changes are in one commit. It would be much easier to review if this was split into several commits. For example, one commit for docs, one for the linter, one for renaming, and one for the recording rule for backward compatibility. Reviewing everything in one commit is very hard.

Also, we already have a metrics docs generator in AAQ:
https://github.com/kubevirt/application-aware-quota/blob/main/tools/metrics-docs/metricsdocs.go

One more note: AAQ uses Prow for automation, not GitHub Actions. I prefer not to mix these two. If needed, we can add a postsubmit job later using:
https://github.com/kubevirt/project-infra/blob/main/github/ci/prow-deploy/files/jobs/kubevirt/application-aware-quota/application-aware-quota-postsubmits.yaml

We can also do this as follow-up work later.

@sradco sradco force-pushed the update_metric_name branch from 6dbda3f to 55e0b0b Compare January 5, 2026 11:55
@sradco
Copy link
Author

sradco commented Jan 5, 2026

@Barakmor1 Hi, Updated the PR. Please review

@sradco
Copy link
Author

sradco commented Jan 7, 2026

@Barakmor1 Thank you for the review. I updated the PR based on your review. Please review again.

@sradco sradco force-pushed the update_metric_name branch from 24c5410 to 42ecc7a Compare January 13, 2026 11:41
Update the use of
github.com/machadovilaca/operator-observabilit to
github.com/rhobs/operator-observability-toolkit

Signed-off-by: Shirly Radco <[email protected]>
Updated
kube_application_aware_resourcequota_creation_timestamp
to
kube_application_aware_resourcequota_creation_timestamp_seconds
to comply with the Prometheus naming conventions.

Signed-off-by: Shirly Radco <[email protected]>
Add a backwards compatability recording rule,
kube_application_aware_resourcequota_creation_timestamp,
since the original metric name was updated to
kube_application_aware_resourcequota_creation_timestamp_seconds

Signed-off-by: Shirly Radco <[email protected]>
Signed-off-by: Shirly Radco <[email protected]>
@sradco sradco force-pushed the update_metric_name branch from 42ecc7a to 35ba0df Compare January 13, 2026 13:18
@sradco
Copy link
Author

sradco commented Jan 13, 2026

@Barakmor1 Hi, Updated the PR. Please review

Comment on lines +27 to +29
"prometheus": "k8s",
"role": "alert-rules",
"aaq.kubevirt.io": "",
Copy link
Member

Choose a reason for hiding this comment

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

why do we need these labels?

Copy link
Member

Choose a reason for hiding this comment

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

wouldn't "aaq.kubevirt.io": "", be enough?

Comment on lines +39 to +47
// Build PrometheusRule from registered rules (recording rules and alerts)
// If building rules fails (e.g., none registered), we proceed with the other resources.
var prometheusRule *promv1.PrometheusRule
if err := aaqrules.SetupRules(); err == nil {
if ruleObj, buildErr := aaqrules.BuildPrometheusRule(namespace); buildErr == nil {
prometheusRule = ruleObj
}
}

Copy link
Member

@Barakmor1 Barakmor1 Jan 14, 2026

Choose a reason for hiding this comment

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

can you move this below

	prometheusResources := []client.Object{
		namespaced.NewPrometheusServiceMonitor(namespace),
		namespaced.NewPrometheusRole(namespace),
		namespaced.NewPrometheusRoleBinding(namespace),
		namespaced.NewPrometheusService(namespace),
	}

and include this code on the same block:

		prometheusResources = append(prometheusResources, prometheusRule)

something like:

	if err := aaqrules.SetupRules(); err == nil {
		if ruleObj, buildErr := aaqrules.BuildPrometheusRule(namespace); buildErr == nil {
		    prometheusResources = append(prometheusResources, ruleObj)
		}
	}

Copy link
Member

@Barakmor1 Barakmor1 left a comment

Choose a reason for hiding this comment

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

left some comments

Comment on lines 86 to 94
// For PrometheusRule, ensure Spec is reconciled as well (labels/annotations handled by MergeObject)
if prDesired, ok := desired.(*promv1.PrometheusRule); ok {
if prCurrent, ok2 := merged.(*promv1.PrometheusRule); ok2 {
// Copy spec if differs
if !equality.Semantic.DeepEqual(prCurrent.Spec, prDesired.Spec) {
prCurrent.Spec = prDesired.Spec
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

why do we need this?

Copy link
Author

Choose a reason for hiding this comment

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

Removed. No need for this explicit test.

Update the doc-generator based on the other
kubevirt operators and add
support for metrics and recording rules.

Signed-off-by: Shirly Radco <[email protected]>
@sradco sradco force-pushed the update_metric_name branch from 35ba0df to 35a4818 Compare January 14, 2026 14:44
@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

The full list of commands accepted by this bot can be found here.

Details 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

@sradco
Copy link
Author

sradco commented Jan 15, 2026

/test pull-aaq-generate-verify

@sradco
Copy link
Author

sradco commented Jan 15, 2026

@Barakmor1 all tests pass. Please review

@Barakmor1
Copy link
Member

Hey, there are some comments that weren’t addressed yet:
#169 (comment)

#169 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has DCO signed all their commits. 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.

3 participants