Metrics API

Retrieve metrics and monitoring data for branches

The Metrics API allows you to retrieve performance and monitoring metrics for your database branches, including CPU, memory, and disk usage.

Get branch metrics

Retrieves metrics for a specific branch over a time period.

POST /organizations/{organizationID}/projects/{projectID}/branches/{branchID}/metrics

Path parameters

ParameterTypeDescription
organizationIDstringUnique identifier for the organization
projectIDstringUnique identifier for the project
branchIDstringUnique identifier for the branch

Request body

{
  "start": "2024-01-01T00:00:00Z",
  "end": "2024-01-01T23:59:59Z",
  "metric": "cpu",
  "instances": ["inst_123", "inst_456"],
  "aggregations": ["avg", "max", "min"]
}

Request body parameters

ParameterTypeDescription
startstring (date-time)Start time for the metrics query
endstring (date-time)End time for the metrics query
metricstringMetric name to query. Options: cpu, memory, disk
instancesarrayList of instance IDs to query
aggregationsarrayList of aggregations to apply. Options: avg, max, min

Response

{
  "start": "2024-01-01T00:00:00Z",
  "end": "2024-01-01T23:59:59Z",
  "metric": "cpu",
  "unit": "percentage",
  "series": [
    {
      "instance": "inst_123",
      "aggregation": "avg",
      "data": [
        {
          "timestamp": "2024-01-01T00:00:00Z",
          "value": 25.5
        },
        {
          "timestamp": "2024-01-01T01:00:00Z",
          "value": 30.2
        }
      ]
    },
    {
      "instance": "inst_123",
      "aggregation": "max",
      "data": [
        {
          "timestamp": "2024-01-01T00:00:00Z",
          "value": 45.0
        },
        {
          "timestamp": "2024-01-01T01:00:00Z",
          "value": 52.1
        }
      ]
    }
  ]
}

Response fields

FieldTypeDescription
startstring (date-time)Start time of the metrics period
endstring (date-time)End time of the metrics period
metricstringThe metric type that was queried
unitstringThe unit of measurement (percentage, bytes, ms, etc.)
seriesarrayArray of metric series, one per instance and aggregation

Metric types

  • cpu: CPU usage percentage
  • memory: Memory usage in bytes
  • disk: Disk usage in bytes

Aggregation types

  • avg: Average value over the time interval
  • max: Maximum value over the time interval
  • min: Minimum value over the time interval