Compute

Preview — pending review

This reference is generated from the platform API contract and is still under review. Operations, fields, and descriptions can change before publication.

Read VM metric time series for one instance (Monitoring tab)

GET
/scopes/{scopeId}/compute/instances/{instanceId}/metrics

Returns chart data for the instance's Monitoring tab: CPU %, memory % (+ page cache, swap), per-disk read/write MB/s, IOPS and latency, per-NIC in/out Mbps, packets, errors and drops. Samples come from the Prometheus that scrapes the compute host's libvirt exporter (30 s scrape, 7 d retention on dev). vCPU steal/delay are deliberately not offered. CPU % (cpu.utilization) is measured on the hypervisor from the vCPU threads' run time divided by the vCPU count; under heavy network/interrupt load it can read higher than the guest operating system shows. Alert rules on cpu.utilization evaluate the same series. A volume's disk metrics appear here, on the instance it is attached to, as the series whose labels.volumeId is that volume's id. Tenant isolation: the caller never sends a query. The backend resolves the instance under the scope and builds every query from a fixed template pinned to that instance's provider server id AND the scope's provider project id; an instance of another project is 404 NOT_FOUND exactly like the detail read. Monitoring switched off: when monitoringEnabled is false no metric is read (and none is billed): 200 with status: MONITORING_DISABLED and an empty metrics array. Turn it on with PATCH .../instances/{instanceId} {monitoringEnabled: true}. An instance that has no provider server yet answers status: NOT_PROVISIONED, also without reading anything. Switched-off spans: Prometheus keeps samples for the retention window whatever the switch says; samples inside the window taken while monitoring was OFF are returned with v: null (a gap), so a customer never sees the span they turned off (and were not billed for). Empty series: status: OK with a metric whose series is empty means the store holds no sample for it in the window (a just-started VM, or memory.utilization on a guest without a balloon driver — Windows needs the virtio balloon driver AND its service). Validation: metric is required, 1–20 names from the closed InstanceMetricName vocabulary; range is 1h|6h|24h|7d (default 1h); step, when given, is 30 seconds to min(range, 86400) seconds and must yield at most 1500 points over the range, otherwise 422 VALIDATION_FAILED. Default steps: 60 s (1h), 120 s (6h), 300 s (24h), 1800 s (7d). Async & state: Synchronous read; no state change. Errors: 401; 403 without compute read access; 404 unknown/other-project instance; 422 invalid parameters; 503 PROVIDER_UNAVAILABLE when the metrics store is unreachable or not configured (never an empty chart that would look like an idle VM); 500 INTERNAL. Idempotency/Concurrency: Safe; no idempotency key.

Authorization

bearerToken
headerAuthorizationBearer <token>

An API token (pc_live_…) or a service-account key (sak_live_…), created in Identity & Access Management and sent as Authorization: Bearer <token>. Requests are rate limited per credential and per tenant: every response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset, and a refused request gets 429 RATE_LIMITED with Retry-After.

Path Parameters

scopeId*string

Opaque ownership+authorization scope resolving to tenant + subscription + project.

instanceId*string

Identifier of the compute instance.

Query Parameters

metric*array<>

One or more metric names (repeat the parameter). Each becomes one entry of metrics, in request order.

Items1 <= items <= 20
range?string

Chart window ending now.

Default"1h"
Value in"1h""6h""24h""7d"
step?integer

Resolution in seconds; defaults per range (60 / 120 / 300 / 1800). Must also be at most the range itself (3600 for 1h) and yield at most 1500 points, otherwise 422.

Range30 <= value <= 86400

Response Body

Metric series for the instance (or a status explaining why none were read).

application/json
  1. response

Metric series of one instance over a window.

instanceId*string
monitoringEnabled*boolean
status*InstanceMetricsStatus

OK — metrics were read (series may still be empty); MONITORING_DISABLED — monitoring is off for the instance, nothing was read; NOT_PROVISIONED — the instance has no provider server (or its project no provider projection) yet, nothing was read.

Value in"OK""MONITORING_DISABLED""NOT_PROVISIONED"
range*MetricRange

A chart window ending now; bounded by the metrics retention.

Default"1h"
Value in"1h""6h""24h""7d"
stepSeconds*integer
start*string
Formatdate-time
end*string
Formatdate-time
metrics*array<>
curl -X GET "https://example.com/scopes/string/compute/instances/string/metrics?metric=cpu.utilization"
{  "instanceId": "string",  "monitoringEnabled": true,  "status": "OK",  "range": "1h",  "stepSeconds": 0,  "start": "2019-08-24T14:15:22Z",  "end": "2019-08-24T14:15:22Z",  "metrics": [    {      "metric": "cpu.utilization",      "unit": "percent",      "series": [        {          "labels": {            "device": "string",            "volumeId": "string",            "macAddress": "string"          },          "points": [            {              "t": 0,              "v": 0            }          ]        }      ]    }  ]}