refactor: Rename resource types in project capacity metrics#823
Conversation
…'ram' in VMware project utilization
…'ram' in KVM project utilization
📝 WalkthroughWalkthroughThis PR standardizes Prometheus capacity metric resource label values across KVM and VMware project utilization KPIs, renaming CPU from ChangesCapacity Metric Label Unification
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/knowledge/kpis/plugins/infrastructure/vmware_project_utilization.go (1)
122-123: Breaking label rename — ensure all downstream metric consumers are updated.The
resourcelabel values"vcpu"and"memory"are renamed to"cpu"and"ram"in the emitted Prometheus metriccortex_vmware_project_capacity_usage. Any Grafana dashboards, recording rules, or alerting rules that matchresource="vcpu"orresource="memory"will silently produce empty results after this deploy.🤖 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 122 - 123, The change renames the Prometheus `resource` label values from "vcpu"/"memory" to "cpu"/"ram" for the metric emitted via k.capacityUsagePerProjectAndHost (cortex_vmware_project_capacity_usage), which will break downstream consumers; restore the original label values ("vcpu" and "memory") in the two calls that create the metric (the lines that currently append "cpu" and "ram") or, if the rename is intentional, update all downstream dashboards/recording/alerting rules and document the migration — ensure the emitted label values match the existing consumers or coordinate a repo-wide update.
🤖 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.
Nitpick comments:
In
`@internal/knowledge/kpis/plugins/infrastructure/vmware_project_utilization.go`:
- Around line 122-123: The change renames the Prometheus `resource` label values
from "vcpu"/"memory" to "cpu"/"ram" for the metric emitted via
k.capacityUsagePerProjectAndHost (cortex_vmware_project_capacity_usage), which
will break downstream consumers; restore the original label values ("vcpu" and
"memory") in the two calls that create the metric (the lines that currently
append "cpu" and "ram") or, if the rename is intentional, update all downstream
dashboards/recording/alerting rules and document the migration — ensure the
emitted label values match the existing consumers or coordinate a repo-wide
update.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: fe197d4d-63f6-4ab1-a9e4-20debfc67c76
📒 Files selected for processing (4)
internal/knowledge/kpis/plugins/infrastructure/kvm_project_utilization.gointernal/knowledge/kpis/plugins/infrastructure/kvm_project_utilization_test.gointernal/knowledge/kpis/plugins/infrastructure/vmware_project_utilization.gointernal/knowledge/kpis/plugins/infrastructure/vmware_project_utilization_test.go
Test Coverage ReportTest Coverage 📊: 69.1% |
Changes
vcpu->cpu&memory->ram