---
id: w3/m4.5/t002
title: "Limit labels on Memory/CPU cards from CPU_LIMIT/MEMORY_LIMIT (aggregateAllMethod: MAX)"
worker: worker3
status: done
estimate: 30m
depends_on: [w3/m4.5/t001]
---

## Objective

Show Render's "Limit — 512 MB / 0.5 CPU" affordance on the Memory and CPU cards, sourced from the `MEMORY_LIMIT`/`CPU_LIMIT` metrics the backend already serves.

## Context

- Render's card header: heading + `Limit` link + the value (`512 MB` / `0.5 CPU`), Limit linking to its plan page — bex has no plan page, so render label + value as plain text.
- Backend contract (verified in w3/m2, live-captured from Render's dashboard): `metrics(query: {name: "MEMORY_LIMIT", aggregateAllMethod: "MAX", ...})` returns one collapsed series with the max limit across replicas; same for `CPU_LIMIT`. A pod with no limit yields no series — hide the label then (Render always has one because plans always set limits; bex apps may not).
- Format cores as Render does (`0.5 CPU`) and bytes with the existing byte formatter.

## Steps

1. Fetch the two `*_LIMIT` metrics alongside the usage series (or extend `use-metrics.ts`).
2. Render the label in the card header; hide when no limit series returns.
3. Optionally overlay the limit as a horizontal reference line on the Total-tab chart (cheap with the svg charts; skip if it clutters).

## Files

- `dashboard/src/features/metrics/components/application-metrics-card.tsx`
- `dashboard/src/features/metrics/hooks/use-metrics.ts`

## Acceptance criteria

- [ ] An app with `tier` limits shows "Limit …" with correct values on both cards; a no-limit app shows no label.
- [ ] Values match `kubectl`-visible pod limits.

## Out of scope

- Linking Limit to a plan/scaling page (none exists).
