Get Resource Usage History
resource_usage_historyTime-range resource-usage history for ONE environment (CPU, memory, network/bandwidth, request throughput, latency percentiles, error rate, and instance count), read live from Cloud Monitoring.
UNITS: read these before interpreting a number: cpu and memory
are FRACTIONS from 0 to 1 of the environment's configured limit (see
limits), NOT percentages and NOT absolute values. Multiply by
limits.cpu/limits.memory_mb to get an absolute vCPU/MB figure.
network values are BYTES per step_seconds-second bucket (not a
rate: divide by step_seconds for bytes/sec), and each bucket is
an independent Cloud Monitoring aggregation (not an overlapping
rolling window), so summing consecutive buckets is safe. throughput
is requests per second. latency percentiles (p50/p95/p99) are
in milliseconds. errors.value is 5xx requests per second and
errors.rate is a percentage of total throughput. instances is a
raw count. A null value in any series is a missing sample, not zero.
summary (min/avg/max/latest per metric, per percentile for latency,
per direction for network) is ALWAYS returned for every metric the
service came back with, regardless of metrics below, and is ALWAYS
computed from the FULL, un-downsampled series. Nulls are skipped
when computing it, and max_points below never affects it, so a
spike or a dip cannot be averaged away from summary even when
series is downsampled.
series (the raw time-stamped points) is returned ONLY for the
metrics named in metrics, which is OPTIONAL and defaults to EMPTY.
Omitting it (or passing []) returns summary only. summary
already tells you whether a metric is worth asking for in series;
requesting raw points for one or more named metrics is always a
second, explicit call. Before downsampling, a raw series has roughly
60 points at range=1h, 288 at 24h, and 168 at 7d. Request
metrics sparingly at wider ranges.
max_points (default 60, minimum 10, maximum 500) bounds how many
points EACH requested series in series can return: a series longer
than max_points is downsampled into at most max_points
equal-width buckets, each bucket's fields AVERAGED across its points
(nulls skipped; a bucket that is all-null for a field stays null),
with each bucket's t taken from its first point. The response's
downsampled is true when this happened to any requested series,
and effective_step_seconds is then step_seconds multiplied by
the bucket width in raw points (null when nothing was downsampled).
Use it to label a chart's x-axis correctly.
Takes the app_id returned by apps_list and the REQUIRED
environment_id returned by environments_list (this data is
per Cloud Run service, so there is no "every environment" answer).
Optional range: 1h, 24h (default), or 7d. For a
live-right-now snapshot instead of history, use resource_usage_get.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"app_id": "<app_id>",
"environment_id": "<environment_id>"
},
"name": "resource_usage_history"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| range | No | Time window: `1h`, `24h`, or `7d`. Default `24h`. | |
| app_id | Yes | The app uuid returned by `apps_list`. | |
| metrics | No | Which metrics to return raw `series` points for, subset of `cpu`, `memory`, `network`, `throughput`, `latency`, `errors`, `instances`. Default EMPTY: `summary` only. `summary` always covers every metric regardless of this filter. | |
| max_points | No | Maximum points per requested series in `series`; a longer series is downsampled (averaged into equal-width buckets). Default 60, minimum 10, maximum 500. Never affects `summary`, which always reflects the full series. | |
| environment_id | Yes | The environment uuid returned by `environments_list`. Required. This data is per Cloud Run service. | |
| organization_id | No | An organisation uuid or slug. When supplied, `app_id` is resolved within that organisation and may be a slug instead of a uuid, mirroring the Meridian web app. |