feat(scorecard): add the ability to drill down into aggregated scorecard data#2350
feat(scorecard): add the ability to drill down into aggregated scorecard data#2350PatAKnight wants to merge 17 commits intoredhat-developer:mainfrom
Conversation
|
Important This PR includes changes that affect public-facing API. Please ensure you are adding/updating documentation for new features or behavior. Changed Packages
|
8398560 to
283d5e7
Compare
PR Compliance Guide 🔍(Compliance updated until commit a14730f)Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label Previous compliance checksCompliance check up to commit 8dec549
Compliance check up to commit 9d3523a
Compliance check up to commit 1ec8035
Compliance check up to commit 8398560
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
PR Code Suggestions ✨Latest suggestions up to 8dec549
Previous suggestions✅ Suggestions up to commit 8398560
|
||||||||||||||||||||||||||||||||||||
…ard data Signed-off-by: Patrick Knight <pknight@redhat.com>
Signed-off-by: Patrick Knight <pknight@redhat.com>
Signed-off-by: Patrick Knight <pknight@redhat.com>
Signed-off-by: Patrick Knight <pknight@redhat.com>
Signed-off-by: Patrick Knight <pknight@redhat.com>
Signed-off-by: Patrick Knight <pknight@redhat.com>
Signed-off-by: Patrick Knight <pknight@redhat.com>
Signed-off-by: Patrick Knight <pknight@redhat.com>
Signed-off-by: Patrick Knight <pknight@redhat.com>
…g fetch Signed-off-by: Patrick Knight <pknight@redhat.com>
Signed-off-by: Patrick Knight <pknight@redhat.com>
…ser credentials during catalog fetch Signed-off-by: Patrick Knight <pknight@redhat.com>
…a param Signed-off-by: Patrick Knight <pknight@redhat.com>
Signed-off-by: Patrick Knight <pknight@redhat.com>
Signed-off-by: Patrick Knight <pknight@redhat.com>
56ff951 to
9d3523a
Compare
Signed-off-by: Patrick Knight <pknight@redhat.com>
Signed-off-by: Patrick Knight <pknight@redhat.com>
8dec549 to
a14730f
Compare
|



User description
Hey, I just made a Pull Request!
This PR adds the ability to drill down from aggregated scorecard KPIs to view the individual entities that contribute to the overall score. This enables managers and platform engineers to identify specific services impacting metrics and troubleshoot issues at the entity level.
Included is a new endpoint
GET /metrics/:metricId/catalog/aggregations/entitiesthat includes the ability to filter by status, owner, kind, and entity name. Theownerparameter accepts multiple values (e.g.,?owner=a&owner=b, up to 50) so that frontends can implement "owned by me" scoping by passing the user's ownership refs directly. The endpoint also includes the ability to sort by entity name, owner, kind, timestamp, and metric value. Finally, offset-based pagination has been included.I also added the
entity_kindandentity_ownercolumns to themetric_values table. This allows all filtering and sorting to be performed at the database level, keeping queries efficient even at large entity counts. All filters,ORDER BY, andLIMIT/OFFSETare pushed to the database so only the requested page of rows is ever fetched.The
entityNamefilter performs a case-insensitive substring search against the full entity reference (kind:namespace/name), rather than just the entity name, which keeps it consistent with how references are stored and avoids an additional column.I also batch-fetch from the catalog using
getEntitiesByRefsto ensure metadata is accurate and up-to-date. This call also serves as the per-row authorization gate — entities the user doesn't havecatalog.entity.readaccess to are returned asnullby the catalog and are excluded from the response.Which issue(s) does this PR fix
✔️ Checklist
Testing the changes
1. Get All Entities for a Metric (Default)
2. Get Second Page (if you have multiple pages)
3. Get More Results Per Page
4. Get Entities in Error State
5. Get Only Components
6. Get Only Systems (lowercase — filter is case-insensitive)
7. Get Entities Owned by Development Guests Team
8. Get Entities Owned by Guest User
9. Get Entities Owned by Multiple Teams (repeat the
ownerparam)10. Search for "scorecard" Services (substring match against full entity ref)
11. Search Using the Full Ref Format
12. Sort by Entity Name (Alphabetically)
13. Sort by Metric Value (Highest First)
14. Combine Filters — Team Errors Sorted by Metric Value
PR Type
Enhancement
Description
Add drill-down endpoint to view individual entities contributing to aggregated scorecard metrics
Implement database-level filtering by status, owner, and kind for optimal performance
Add entity metadata columns (
entity_kind,entity_owner) tometric_valuestable with indexesSupport application-level filtering by entity name, sorting, and pagination with comprehensive tests
Include batch catalog enrichment and graceful fallback when catalog metadata unavailable
Diagram Walkthrough
File Walkthrough
7 files
Add readEntityMetricsByStatus method for filtered entity metricsAdd entity_kind and entity_owner fields to metric typesImplement getEntityMetricDetails with filtering, sorting, paginationAdd GET endpoint for entity drill-down with permission checksPopulate entity_kind and entity_owner during metric collectionAdd EntityMetricDetail and EntityMetricDetailResponse typesPass logger to CatalogMetricService constructor1 files
Create migration to add entity_kind and entity_owner columns6 files
Add comprehensive tests for readEntityMetricsByStatus functionalityAdd tests for getEntityMetricDetails with filters and sortingAdd endpoint tests for entity drill-down with permissionsUpdate tests to verify entity metadata populationAdd mock for readEntityMetricsByStatus database methodAdd getMetric mock implementation to registry2 files
Add comprehensive documentation for drill-down endpointAdd changeset for drill-down feature release