SLO API¶
The SLO (Service Level Objectives) API provides endpoints for defining reliability targets, tracking error budgets, and managing SLO lifecycle.
Base URL¶
Authentication¶
All endpoints require a valid JWT token via Authorization: Bearer <token> header.
Endpoints¶
List SLOs¶
Query Parameters:
| Parameter | Type | Description |
|---|---|---|
componentId | string | Filter by component UUID |
metricType | string | Filter by metric type |
window | string | Filter by evaluation window |
enabled | boolean | Filter by enabled/disabled status |
skip | number | Pagination offset (default: 0) |
take | number | Page size (default: 20) |
Response: 200 OK
{
"data": [
{
"id": "uuid",
"name": "api-availability",
"description": "API gateway must maintain 99.95% availability",
"targetPercent": 99.95,
"metricType": "availability",
"window": "30d",
"componentId": "uuid",
"organizationId": "uuid",
"enabled": true,
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z"
}
],
"total": 1,
"skip": 0,
"take": 20
}
Create SLO¶
Requires: admin role.
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Unique name for the SLO |
targetPercent | number | Yes | Target percentage (0-100) |
metricType | string | Yes | One of: availability, latency, error_rate |
window | string | Yes | One of: 7d, 30d, 90d |
description | string | No | Human-readable description |
componentId | string | No | UUID of the component this SLO is scoped to |
enabled | boolean | No | Whether the SLO is active (default: true) |
Response: 201 Created
Get SLO¶
Response: 200 OK with the SLO object.
Update SLO¶
Requires: admin role. Accepts partial updates with the same fields as creation.
Response: 200 OK with the updated SLO.
Delete SLO¶
Requires: admin role.
Response: 204 No Content
Get Error Budget¶
Returns the current error budget status for an SLO based on Prometheus metrics (or simulated data if Prometheus is not configured).
Response: 200 OK
{
"sloId": "uuid",
"name": "api-availability",
"targetPercent": 99.95,
"currentPercent": 99.97,
"budgetTotal": 0.05,
"budgetConsumed": 0.03,
"budgetRemaining": 40.0,
"burnRate": 0.45,
"status": "healthy",
"windowStart": "2024-01-01T00:00:00.000Z",
"windowEnd": "2024-01-31T00:00:00.000Z"
}
Field Descriptions:
| Field | Type | Description |
|---|---|---|
budgetTotal | number | Total error budget in percentage points (100 - targetPercent, e.g., 0.05 for a 99.95% target) |
budgetConsumed | number | Error budget consumed so far in percentage points (e.g., 0.03 means 0.03 percentage points have been consumed) |
budgetRemaining | number | Percentage of the total error budget still remaining on a 0-100 scale (e.g., 40.0 means 40% of the error budget has not been used) |
burnRate | number | Rate of budget consumption relative to the elapsed window fraction (1.0 = on track, >1.0 = consuming faster than sustainable) |
Budget Status Values:
| Status | Description |
|---|---|
healthy | More than 50% of error budget remains |
warning | 10-50% of error budget remains |
critical | Less than 10% of error budget remains |
exhausted | Error budget is fully consumed |
Enums¶
SloMetricType¶
| Value | Description |
|---|---|
availability | Uptime / availability metric |
latency | Response latency metric |
error_rate | Error rate metric |
SloWindow¶
| Value | Description |
|---|---|
7d | 7-day rolling window |
30d | 30-day rolling window |
90d | 90-day rolling window |