---
id: w3/m10/t001
title: "Autoscale-target line: surface the HPA/autoscaling target utilization alongside current CPU/mem usage"
worker: worker3
status: todo
estimate: 45m
depends_on: []
---

## Objective

Add the autoscale-target utilization value to the resource-metrics API/response, so the metrics page can chart "current usage vs. target" the way Render does, using the per-service autoscaling config shipped in `w1/m20`.

## Context

- `lego/backend/internal/metrics/` — resource-metrics API (cAdvisor/metrics-server backed, `w3/m4`).
- `w1/m20` — per-service autoscaling (`PUT …/autoscaling`), stores the target CPU/mem utilization percentage on the `App` spec.

## Steps

1. Read the App's autoscaling target (CPU/mem %) from its spec.
2. Add a `target` field alongside the existing current-usage series in the resource-metrics response (REST/GraphQL/MCP).
3. Return it as absent/omitted for services with autoscaling disabled (no target configured).

## Files

- `lego/backend/internal/metrics/`

## Acceptance criteria

- [ ] A service with autoscaling enabled returns its configured target alongside current CPU/mem usage.
- [ ] A service without autoscaling configured omits the target field (not a fake zero).

## Out of scope

- Disk, DB connections, replication lag — separate tasks.
