Repository navigation
feat: show restarts and resource limits on the app detail page without metrics-server - #164
Merged
Merged
Conversation
GET /apps/{ns}/{name}/metrics now joins metrics.k8s.io usage with data
read from the app's pods (one list call by the app label): the `app`
container's restarts, last termination (reason, exit code, finish time),
start time, and CPU/memory limits and requests. The pod data comes back
even when `available` is false (no metrics-server). Fields are added,
none renamed. The termination reason is kept only when it is a plain
identifier, and the container's termination message is never read.
The MCP get_app_metrics docstring describes the new fields.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The app detail page's CPU and Memory cards said "Metrics unavailable" on clusters without metrics-server. Restarts shows the app container's restart count, uptime and how its last run ended (with a memory-limit hint after an OOMKilled); Resources shows the limits always and live usage against them, with the sparkline history, when metrics-server is there. Failed apps keep the cards, since their crash-looping pods are what the cards explain; stopped and idle apps still explain their absence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
📄 Docs preview for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The app detail page's CPU and Memory cards said "Metrics unavailable" on any cluster without metrics-server. They are replaced by cards that always show something, built from pod status and spec.
API (
GET /apps/{ns}/{name}/metrics, still behindauthorized_app, no new route)Store.pod_healthlists the app's pods once by the app label and returns, for theappcontainer:restarts,lastTermination({reason, exitCode, finishedAt}or null),startedAt(when it started running, null while it is not), andlimits/requests({cpu, memory}as"500m"/"512Mi", parsed like usage).availablestill means "metrics-server answered"; the pod data comes back either way. Finished pods (Succeeded/Failed, e.g. evicted) are skipped, and usage for a pod no longer listed is dropped.PodMetric, none renamed. One behaviour change: withavailable: false,podsis no longer[](it lists the live pods withcpu/memoryset to"").appcontainer only. The authz sidecar's restarts are left out, so the count, last termination, uptime and limits all describe the same container (the user's code)./analytics/metricsstill sums every container, as before.reasonis kept only when it is a plain identifier ([A-Za-z][A-Za-z0-9]{0,63}), so no free text reaches MCP callers and the MCP tool needs no fence. Theget_app_metricsdocstring describes the new fields.UI
relativeTime, with<time datetime>), and for an OOMKilled a short hint that the memory limit may be too low (warning-token icon, muted text).lib/pod-health.tsrolls the pods up;metricValuemoved there asquantity;shortDurationwas added tolib/time.ts.Docs: api-reference, mcp, launching-apps (the detail page's cards), troubleshooting, runbook (metrics-server missing), getting-started.
Test plan
uv lock --check,pytest --cov(312 passed, 91.5%),ruff check,ruff format --check,mypy. Newtests/test_pod_health.pycovers the store parsing: a healthy pod, an OOMKilled pod (only theappcontainer's restarts count), crash-looping (nostartedAt), a non-identifier reason with a message (both dropped), skipped finished pods, a pod with no status or limits, and 404.test_apps.pycovers the route with no metrics-server, joining usage, and dropping usage for pods that are gone.pod_healthwas added to the request-timeout check.pytest --cov(60 passed), ruff, mypy.get_app_metricsreturns pod health with and without metrics-server.npm run check:ci,npm run build,npm run size,npm run test:coverage(278 passed),npm run test:e2e(150 passed: Playwright plus axe in light and dark, desktop and mobile, including the failed app's detail page with the OOMKilled card).bun test test,bun run build.🤖 Generated with Claude Code