Skip to content

feat(status-mix): stacked column chart with ok baseline#38

Open
coccyx wants to merge 1 commit into
masterfrom
feat/status-mix-stacked-columns
Open

feat(status-mix): stacked column chart with ok baseline#38
coccyx wants to merge 1 commit into
masterfrom
feat/status-mix-stacked-columns

Conversation

@coccyx
Copy link
Copy Markdown
Contributor

@coccyx coccyx commented May 27, 2026

Summary

Two requested changes to the Status mix chart on Service Detail:

  1. Chart type → stacked column instead of line. Each column is a 1-minute bucket; segments inside stack bottom-up.
  2. Include ok class → the query no longer filters `status_class != "ok"`. The slate baseline shows total request volume and errors stack visibly above it.

After

`frontend-proxy` over the last hour (ok 71%, 504 13%, 503 10%, 500 5%, 4xx 1%):

status mix

Implementation

  • `src/components/StackedColumnChart.tsx` — new SVG component, reuses `LineChart.module.css` so the shell (title / subtitle / legend / tooltip / empty state) matches sibling panels. Hover tooltip lists segments top-to-bottom matching what the operator sees onscreen, plus a "total" row.
  • `src/api/queries.ts` — dropped the `where status_class != "ok"` filter.
  • `src/api/types.ts` — added `'ok'` to `StatusCodeClass`, reordered `STATUS_CODE_CLASSES` to define stack order (ok at bottom, errors stacked above).
  • `src/routes/ServiceDetailPage.tsx` — swap LineChart → StackedColumnChart for status mix, added the ok color (slate-300).

Test plan

  • Open https://main-objective-shirley-sho21r7.cribl-staging.cloud/ → APM → Services → `frontend-proxy`.
  • Verify the chart is now stacked columns, not lines.
  • Verify the legend includes `ok` (light slate swatch).
  • Verify the bottom slate segment dominates each bar (since ok ≫ errors on a healthy service).
  • Hover a column — tooltip should show segments top-to-bottom + a "total" row.
  • Pick a service with zero errors (e.g. a healthy one). Verify column is solid slate with no error segments.

Pre-merge checks

  • ✓ `npm run lint` — 0 errors, 1 pre-existing warning
  • ✓ `npx tsc --noEmit` — clean
  • ✓ `npm test` — 63/63 passing

🤖 Generated with Claude Code

Two requested changes:

1. **Chart type**: Status mix renders as a stacked column chart
   instead of multiple overlapping lines. Each column is a
   1-minute bucket; segments inside stack bottom-up in the order
   defined by STATUS_CODE_CLASSES.

2. **ok class included**: query no longer filters
   `status_class != "ok"`. The baseline (ok requests, slate-300)
   shows absolute volume and errors stack on top in saturated
   colors, so a mix shift reads at a glance against the volume
   context.

### Files

- `src/components/StackedColumnChart.tsx` (new) — SVG-based,
  reuses LineChart.module.css for the shell (title / subtitle /
  legend / tooltip / empty-state) so it matches the sibling
  panels. Hover tooltip lists segments top-to-bottom matching
  what the operator sees onscreen, plus a total row.
- `src/api/queries.ts` — drop the `status_class != "ok"` filter.
- `src/api/types.ts` — add `'ok'` to `StatusCodeClass` and
  reorder `STATUS_CODE_CLASSES` to define stack order (ok at
  bottom, error classes stacked above).
- `src/routes/ServiceDetailPage.tsx` — swap LineChart →
  StackedColumnChart for status mix, add the ok color (slate)
  and reshape series for stacking.

Screenshot evidence in
`docs/sessions/screenshots/2026-05-27-status-mix-stacked-columns/`.

Pre-PR checks: lint clean (0 errors), typecheck clean,
63/63 unit tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant