feat: add vmware project utilization kpi#768
Conversation
Co-authored-by: Copilot <copilot@github.com>
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ 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 (4)
📝 WalkthroughWalkthroughThis PR introduces a new VMware project utilization KPI plugin that monitors resource utilization for projects running VMs on VMware hosts. It includes the KPI implementation with Prometheus metrics, supporting infrastructure modules for VMware-specific metadata handling, comprehensive test coverage, Helm configuration, and registry integration. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 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)
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. Review rate limit: 0/1 reviews remaining, refill in 39 minutes and 23 seconds.Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@helm/bundles/cortex-nova/templates/kpis.yaml`:
- Around line 210-215: The KPI declares dependencies but is missing the
host-details knowledge; since Collect() always loads the host-details Knowledge
before emitting metrics, add "host-details" to the knowledges dependency list
(the dependencies -> knowledges block) so the KPI waits for host-details to be
available before scraping; locate the dependencies/knowledges section (the
entries under dependencies: datasources: ... knowledges: ...) and insert an
entry with name "host-details".
In `@internal/knowledge/kpis/plugins/infrastructure/vmware_metrics.go`:
- Around line 1-8: Add the required repository license header to the top of this
Go source (vmware_metrics.go) by inserting the two comment lines "// Copyright
SAP SE" and "// SPDX-License-Identifier: Apache-2.0" immediately above the
package declaration (package infrastructure) so the file complies with the
mandated Go license header policy.
In
`@internal/knowledge/kpis/plugins/infrastructure/vmware_project_utilization_test.go`:
- Around line 195-205: Add a stopped/shelved instance to the existing test case
"instances with non-ACTIVE status are excluded" so the ACTIVE-only contract is
validated for SHUTOFF/SHELVED states: in the servers slice add one server with
Status set to "SHUTOFF" (or a SHELVED_* variant) and the same
TenantID/Host/Flavor/AZ as the others, and keep expectedCounts unchanged (only
the ACTIVE server counted). Apply the same addition to the other equivalent test
scenarios in this file that validate non-ACTIVE exclusion so
vmwareProjectInstanceCount expectations still only include ACTIVE instances.
In
`@internal/knowledge/kpis/plugins/infrastructure/vmware_project_utilization.go`:
- Around line 158-174: The WHERE clause in queryProjectCapacityUsage() (and
similarly in queryProjectInstanceCount()) currently filters out only DELETED and
ERROR states, which still includes non-running instances; change the predicate
to restrict to running/active VMs by replacing the status filter with an
explicit s.status = 'ACTIVE' (or equivalent ACTIVE-only predicate) in the SQL
built against nova.Server{}.TableName(), ensuring the same change is applied to
both queryProjectCapacityUsage() and queryProjectInstanceCount() that also use
vmwareComputeHostPattern/vmwareIronicComputeHostPattern.
🪄 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: 7ad679e9-385e-419d-b86c-f4f5b557bd1d
📒 Files selected for processing (5)
helm/bundles/cortex-nova/templates/kpis.yamlinternal/knowledge/kpis/plugins/infrastructure/vmware_metrics.gointernal/knowledge/kpis/plugins/infrastructure/vmware_project_utilization.gointernal/knowledge/kpis/plugins/infrastructure/vmware_project_utilization_test.gointernal/knowledge/kpis/supported_kpis.go
…d rename project-details to host-details Co-authored-by: Copilot <copilot@github.com>
Test Coverage ReportTest Coverage 📊: 69.2% |
Changes
internal/knowledge/kpis/pluginsto collect all infrastructure dashboard related metrics since they share some common features