cockroachdb / cockroachdb/cockroach

ui: metrics chart legend shows "Invalid date" instead of "--" when cursor is off the chart

Open Beginner friendly
#173,282 1 comment 0 reactions 0 assignees View on GitHub
A-sql-console-timeseries C-bug O-agent T-observability
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

**Describe the problem**

On the DB Console **Metrics** page, when the pointer is outside a chart's plot area (no data point hovered), the chart legend renders `Time: Invalid date` instead of `Time: --`.

The uPlot legend's time (x-series) value formats the hovered timestamp through the `xAxisDomain` formatter, which isn't guarded against uPlot passing a `null` cursor value when the pointer is off-chart, so `null` is run through the date formatter and yields "Invalid date".

**To Reproduce**

1. Open DB Console → **Metrics**.
2. Move the pointer off any chart's plot area.
3. The legend under the chart reads `Time: Invalid date`.

**Expected behavior**

The legend time reads `--` when no timestamp is hovered.

**Additional data**

- `pkg/ui/workspaces/db-console/src/views/cluster/components/linegraph/index.tsx` (uPlot options; x-series/legend value)
- `pkg/ui/workspaces/db-console/src/views/cluster/util/graphs.ts` (`getLatestXAxisDomain().tickFormat`)
- Suggested fix: null-guard the legend time formatter to return `--` for a `null`/`NaN` timestamp.
- Pre-existing; the last relevant change to this code was the uPlot 1.6.19→1.6.31 upgrade in `7ff0db4567f`.

**Environment:** DB Console, CockroachDB v26.2.3

**Additional context**

Cosmetic; low impact.

Jira issue: CRDB-66604

Contributor guide

Open the contributing guide

Research direction

Start in pkg/ui/workspaces/db-console/src/views/cluster/components/linegraph/index.tsx and inspect the uPlot legend and x-series formatter, then read getLatestXAxisDomain().tickFormat in pkg/ui/workspaces/db-console/src/views/cluster/util/graphs.ts. Reproduce the issue by moving the pointer off a DB Console Metrics chart; done means the legend shows "Time: --" instead of "Invalid date" when no timestamp is hovered.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, observability
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
85/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.