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",
  "metrics": [],
  "aggregations": [],
  "instances": [
    "<string>"
  ]
}
'
{
  "start": "2023-11-07T05:31:56Z",
  "end": "2023-11-07T05:31:56Z",
  "results": [
    {
      "metric": "<string>",
      "unit": "<string>",
      "series": [
        {
          "instanceID": "<string>",
          "values": [
            {
              "timestamp": "2023-11-07T05:31:56Z",
              "value": 123
            }
          ]
        }
      ]
    }
  ]
}

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

metrics
enum<string>[]
required

List of metric names to query.

Required array length: 1 - 15 elements

Name of a branch metric exposed by the API.

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
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 per metric in the response.

Available options:
avg,
max,
min
instances
string[]

List of instance IDs to query

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
results
object[]
required

One entry per requested metric, in the order the metrics were requested.