Fix inflated dashboard host count for Constructed Inventories (Issue #1459)#16359
Fix inflated dashboard host count for Constructed Inventories (Issue #1459)#16359TheDevCodingKen wants to merge 3 commits intoansible:develfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughDashboard host-count logic now excludes hosts coming from virtual inventories (inventories with kind Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 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)
📝 Coding Plan
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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@awx/api/views/__init__.py`:
- Around line 211-212: The host counts use values('name').distinct().count(),
which undercounts hosts that share a name across inventories because Host.name
is only unique per-inventory; change the deduplication to use instance_id (or
inventory-scoped filtering) instead: update the two usages of
user_hosts.values('name').distinct().count() and
user_hosts_failed.values('name').distinct().count() to count distinct non-empty
instance_id (e.g., exclude empty instance_id and use
values('instance_id').distinct().count()) or apply inventory-aware filtering
depending on the calling context so Host instance uniqueness is correctly
measured.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6a73207a-27b7-48ff-bbc6-d7631da0a06c
📒 Files selected for processing (1)
awx/api/views/__init__.py
cd9ce19 to
2592ff8
Compare
|
@coderabbitai resume |
✅ Actions performedReviews resumed. |
Signed-off-by: TheDevCodingKen <93670654+TheDevCodingKen@users.noreply.github.com>
Signed-off-by: TheDevCodingKen <93670654+TheDevCodingKen@users.noreply.github.com>
…ed inventories Signed-off-by: TheDevCodingKen <93670654+TheDevCodingKen@users.noreply.github.com>
2592ff8 to
12d00a2
Compare
Summary
Fixes ansible/awx-operator#1459
The dashboard previously counted duplicate host records generated by Constructed Inventories, artificially inflating the 'Total' and 'Failed' host metrics.
This PR updates the
DashboardViewAPI queryset to leverage.values('name').distinct().count(). This ensures the underlying SQL query filters out duplicate database rows and accurately reflects the true number of unique managed nodes.Summary by CodeRabbit
Bug Fixes
Tests