feat: add domain_id and name to vmware project capacity metrics#802
Conversation
Co-authored-by: Copilot <copilot@github.com>
|
Warning Rate limit exceeded
To continue reviewing without waiting, purchase usage credits in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughVMware KPI metrics are extended with domain awareness by adding DomainID and DomainName fields to instance count and capacity usage data structures, updating SQL queries to join the Domain table, and propagating domain labels through Prometheus metric descriptors and collection logic. ChangesDomain-Aware VMware KPI Metrics
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-authored-by: Copilot <copilot@github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
internal/knowledge/kpis/plugins/infrastructure/vmware_project_utilization.go (1)
69-72: ⚡ Quick winRefresh the capacity metric help text.
The descriptor still says "per VMware hypervisor and flavor", but this series is now labeled by
project,domain, andresource. That stale help text is user-visible in/metrics.Suggested wording
k.capacityUsagePerProjectAndHost = prometheus.NewDesc( "cortex_vmware_project_capacity_usage", - "Resource capacity used by a project per VMware hypervisor and flavor. CPU in vCPUs, memory and disk in bytes.", + "Resource capacity used by a project per VMware hypervisor. Labeled by project, domain, and resource. CPU in vCPUs, memory and disk in bytes.", append(vmwareHostLabels, "project_id", "project_name", "domain_id", "domain_name", "resource"), nil, )🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/knowledge/kpis/plugins/infrastructure/vmware_project_utilization.go` around lines 69 - 72, Update the prometheus metric help text for the descriptor created in k.capacityUsagePerProjectAndHost (prometheus.NewDesc call) so it no longer says "per VMware hypervisor and flavor" and instead accurately describes that the metric reports resource capacity used by a project, labeled by project_id, project_name, domain_id, domain_name and resource (CPU in vCPUs, memory and disk in bytes); modify the second argument (help string) to reflect this new labeling and semantics.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@internal/knowledge/kpis/plugins/infrastructure/vmware_project_utilization.go`:
- Around line 174-175: The domain_id in the first query should come from the
Project table (p.domain_id) rather than falling back to an empty string when the
Domain join fails; update the SELECT so domain_id is sourced as
COALESCE(p.domain_id, '') (or p.domain_id) and keep the Domain join solely to
populate domain_name (COALESCE(d.name, '') AS domain_name). Apply the same
change to the other query block that currently uses COALESCE(d.id, '') (the
second metric/query around the identity.Project usage) so both metric families
consistently use Project.DomainID (p.domain_id) for domain_id and use the Domain
join only for domain_name.
---
Nitpick comments:
In
`@internal/knowledge/kpis/plugins/infrastructure/vmware_project_utilization.go`:
- Around line 69-72: Update the prometheus metric help text for the descriptor
created in k.capacityUsagePerProjectAndHost (prometheus.NewDesc call) so it no
longer says "per VMware hypervisor and flavor" and instead accurately describes
that the metric reports resource capacity used by a project, labeled by
project_id, project_name, domain_id, domain_name and resource (CPU in vCPUs,
memory and disk in bytes); modify the second argument (help string) to reflect
this new labeling and semantics.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 8204d92d-4c08-4d89-a8fd-e9b7cb709f49
📒 Files selected for processing (2)
internal/knowledge/kpis/plugins/infrastructure/vmware_project_utilization.gointernal/knowledge/kpis/plugins/infrastructure/vmware_project_utilization_test.go
…stance count query Co-authored-by: Copilot <copilot@github.com>
Test Coverage ReportTest Coverage 📊: 69.1% |
### Release digest — 2026-05-07 — [#814](#814) #### cortex v0.0.47 (sha-7d1745d8) **New features:** - `ProjectQuota` CRD with per-resource, per-AZ quota breakdown and PAYG calculation ([#796](#796)) - `FlavorGroupCapacity` CRD + background capacity controller for pre-computed per-flavor VM slot capacity per (flavor group × AZ) ([#728](#728)) - Capacity reporting in `POST /commitments/v1/report-capacity` now uses real `FlavorGroupCapacity` CRD values (replaces placeholder zeros) - CommittedResource usage reconciler — moves usage calculation into CRD status, feeding both LIQUID API and quota controller ([#800](#800)) - KVM OS version label on host capacity metrics ([#810](#810)) - KVM project usage metrics (running VMs / resource usage per project/flavor) ([#803](#803)) - `domain_id` + name on vmware project capacity metrics ([#802](#802)) - `domain_id` in vmware project commitment KPI ([#806](#806)) - Weighing explainer for scheduling decisions ([#808](#808)) **Refactors:** - KVM host capacity metric moved to infrastructure plugins package ([#809](#809)) - Deprecated per-compute KPIs removed (`flavor_running_vms`, `host_running_vms`, `resource_capacity_kvm`) ([#807](#807)) - Bundle-specific RBAC templates moved from library chart into `cortex-ironcore` / `cortex-pods` bundles ([#797](#797)) - Webhook templates moved back into `cortex-nova` ([#805](#805)) - `testlib.Ptr` replaced with native `new()` ([#801](#801)) **Fixes:** - Remove `ignoreAllocations` from kvm-report-capacity pipeline to unblock older admission webhook ([#812](#812)) - Suppress nova scheduling alerts on transient `no such host` DNS errors - Add `identity-domains` as KPI dependency - Rename hypervisor `ClusterRoleBinding` to avoid `roleRef` conflict on redeploy ([#804](#804)) #### cortex-nova v0.0.60 (sha-7d1745d8) Includes cortex v0.0.47. Adds Prometheus datasources and KPI CRD templates for KVM project usage/utilization, and updated RBAC for `FlavorGroupCapacity` + `ProjectQuota` CRDs.
Changes