Skip to main content
POST
/
organizations
/
{organizationID}
/
projects
/
{projectID}
/
branches
/
{branchID}
/
metrics
Retrieve branch metrics
curl --request POST \
  --url https://api.xata.tech/organizations/{organizationID}/projects/{projectID}/branches/{branchID}/metrics \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "start": "2023-11-07T05:31:56Z",
  "end": "2023-11-07T05:31:56Z",
  "metric": "cpu",
  "instances": [
    "<string>"
  ],
  "aggregations": [
    "avg"
  ]
}
'
{
  "start": "2023-11-07T05:31:56Z",
  "end": "2023-11-07T05:31:56Z",
  "metric": "<string>",
  "series": [
    {
      "instanceID": "<string>",
      "aggregation": "avg",
      "values": [
        {
          "timestamp": "2023-11-07T05:31:56Z",
          "value": 123
        }
      ]
    }
  ],
  "unit": "<string>"
}

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Path Parameters

organizationID
string
required
Pattern: [a-zA-Z0-9_-~:]+
projectID
string
required
branchID
string
required

Body

application/json
start
string<date-time>
required

Start time

end
string<date-time>
required

End time

metric
enum<string>
required

Metric name to query

Available options:
cpu,
memory,
disk,
connections_active,
connections_idle,
network_ingress,
network_egress,
iops_read,
iops_write,
latency_read,
latency_write,
throughput_read,
throughput_write,
wal_sync_time,
replication_lag_time
instances
string[]
required

List of instance IDs to query

aggregations
enum<string>[]
required

List of aggregations to get, this is how the data-points within the interval are aggregated. Each one will generate a separate time-series in the response.

Available options:
avg,
max,
min

Response

Metrics for a branch

A collection of metrics (cpu, memory, disk,...) for each of the instances of a branch

start
string<date-time>
required
end
string<date-time>
required
metric
string
required
series
object[]
required
unit
string
required

The unit of the metric (percentage, bytes, ms, etc.)