palbaseDocs

Palbase Machines · API

GET/machines/{name}/metrics

Read what a machine used over time

What the machine used, bucket by bucket, oldest first — what Studio's charts draw. Once a minute the platform records running copies' usage — CPU averaged over the minute and working-set memory — and keeps it summed over the machine's copies, at the minute it was read. A minute nobody measured — the machine slept, or a copy had only just started — is in no bucket, and a bucket none of whose minutes was measured is no row: nothing is filled in, carried across a gap or made up when read. Every field of a row is a gauge: samples is how many minutes were measured in the bucket; cpu_avg_millicores and memory_avg_bytes are their average, and cpu_max_millicores and memory_max_bytes their most, summed over the copies that ran; replicas_max is the most copies that ran in a minute (one more than the machine has while a new version comes up beside the one that serves); cpu_replica_max_millicores and memory_replica_max_bytes are the most one copy used — what limits holds a copy to. limits is what the machine's size gives a copy now — a shared size wakes with a burst CPU (1000m) and settles to its own once it answers — and how many copies it runs while awake. Kept: a machine's minutes 48 hours, its hours 30 days; what is older is deleted, and a deleted machine's is deleted within the hour after it has gone. Buckets are UTC: minute, hour, day.

Called by your server, with the project's secret key.

Path

namestring · requiredThe machine's name: lowercase letters, digits and dashes, starting with a letter and not ending with a dash, 32 at most.

Query

window_secondsinteger · optionalHow far back the answer reaches, in seconds: 1 to 2592000 (30 days); 3600 when left out. Every bucket the window touches is answered whole: the first is the one its start falls in.
bucket"minute" | "hour" | "day" · optionalWhat a row covers. minute reaches 172800 seconds (48 hours) back at most (400 `invalid_bucket` past it). When left out: minute for a window of 6 hours or less, hour up to 7 days, day beyond.
curl
curl -X GET "https://<your-ref>.palbase.studio/machines/<name>/metrics" \
  -H "apikey: $PALBASE_SECRET_KEY"

Responses

200What the machine used, oldest first

400Validation failed or a required field is missing

401Missing or invalid API key

403Not the project's secret key

404The project has no machine of this name

429Over the project's request limit, or its machine time for this period is used up

503Temporarily unavailable; retrying is safe after Retry-After

defaultAn error: the envelope names it (`error`) and explains it (`error_description`).

Operation GetMachineMetrics of machines's contract.