feat(scorecard): add entity-page sparkline charts for time-series metrics - #4573
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
|
|
🤖 Finished Review · ✅ Success · Started 7:36 PM UTC · Completed 7:44 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Cost: $2.16 |
ReviewFindingsMedium
Low
Labels: Feature PR adding new sparkline chart capability to the scorecard workspace. Previous runReviewVerdict: comment This PR adds sparkline (area chart) visualization support for entity-page scorecard metrics, including new chart components, API methods, hooks, utilities, and i18n strings. The architecture is well-structured: components follow the existing project patterns, hooks use the established Two medium-severity findings require attention before merge. Several low-severity items are noted for consideration. Medium1. Stale API report —
|
b56fa91 to
3dd8c8b
Compare
|
🤖 Review · ❌ Terminated · Started 8:53 AM UTC · Ended 9:09 AM UTC Commit: |
|
🤖 Finished Review · ✅ Success · Started 8:53 AM UTC · Completed 9:09 AM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Cost: $9.51 |
|
|
🤖 Finished Review · ✅ Success · Started 9:11 AM UTC · Completed 9:53 AM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Cost: $13.56 |
| /** | ||
| * Maps API time-series points into chart rows. Error / null values keep their | ||
| * x position and get an interpolated Y so the sparkline stays continuous. | ||
| */ |
There was a problem hiding this comment.
[low] edge-case
toAggregationSparklinePoints determines error labels based solely on point.status === 'error'. If a point has status 'success' but value null, no error label is set. toMetricSparklinePoints defensively checks point.value === null as a fallback.
Suggested fix: Add fallback in toAggregationSparklinePoints to handle null values when status is not 'error'.


Hey, I just made a Pull Request!
What
Adds sparkline (area chart) visualization support for entity-page scorecard metrics whose
defaultVisualizationissparkline. This is the foundation PR — shared chart components and utilities are included here and will be reused by the homepage sparkline PR that follows.What changed
New components
SparklineChart— Recharts-based area chart with gradient fill, error-dot markers, hover tooltip, and threshold legendSparklineTooltip/SparklineLegend— supporting chart sub-componentsEntitySparklineCard— entity-page card that fetches time-series data and renders a sparkline with a "View data sources" dialog for collector metadataEntityMetricCard— routing component that rendersEntitySparklineCardor the existingScorecardcard based ondefaultVisualizationNew API methods
getMetricTimeSeries—GET /metrics/catalog/:kind/:namespace/:name/time-seriesgetMetricCollectors—GET /metrics/:metricId/collectorsNew hooks
useMetricTimeSeries—useQuery-based hook for 30-day entity metric time seriesuseMetricCollectors—useQuery-based hook for collector metadata (fetched only when the data-sources dialog is open)New utilities
timeSeriesChartData— maps API points to chart-ready data with interpolation for error gapssparklineLegend— builds threshold legend items with color + line-style pairingsparklineChartModel— shared view-model factory used by both entity and homepage cardsmetricVisualization—isSparklineVisualization()helpertimeSeriesRange— computes the default 30-day ISO-8601 rangeRefactors
DataSourcesDialognow accepts genericSourceRow[]instead of building rows internallycollectorSourceRows.ts(for sparkline metrics) andmetricSourceRows.ts(for existing donut metrics) as separate row buildersGitHub,Jira, empty value--, unavailable statusN/A) are now translated via i18n keys instead of hardcoded stringsTranslations
dataSourcesDialog.*keys toref.tsand all locale files (de, es, fr, it, ja)How to test
defaultVisualization: sparkline)✔️ Checklist