SLO Management API
The SLO Management API provides teams with the ability to efficiently manage their service level objectives (SLOs) programmatically. This API allows users to create and list SLOs and their associated alerts, making it ideal for teams that prefer programmatic access to SLO management.
Prerequisites
Before using the SLO Management API, ensure the following prerequisites are met:
- You must have a personal or team API key. We recommend using permission presets, which are automatically updated with the necessary scopes. Alternatively, you can manually assign individual permissions as needed:
Preset | Action | Description |
---|---|---|
SLO | SLO-MGMT.ALERTS:READCONFIG | View SLO Based Alert Settings |
SLO | SLO-MGMT.ALERTS:UPDATECONFIG | Manage SLO Based Alert Settings |
SLO | SLO-MGMT.SLO:READCONFIG | View SLO Settings |
SLO | SLO-MGMT.SLO:UPDATECONFIG | Manage SLO Settings |
- Use the Management API endpoint that matches your Coralogix domain.
Authentication
Provide the API key in the request authorization header:
Example:
API endpoints
This section includes example requests and responses for the Create and List API methods, formatted for use with gRPCurl.
CreateSlo
Creates a new SLO for the specified service. Use it todefine the parameters of the SLO, including target percentage, filters, and service level indicators (SLIs).
Note
Avoid using a time range in metric queries when a window is defined. For example, if you’ve specified a window, don’t include a range like [5m]
.
Example request:
grpcurl -H "Authorization: Bearer API_KEY_HERE" -d @ https://ng-api-grpc.:443 com.coralogixapis.slo.v1.SlosService/CreateSlo <<EOF
{
"slo": {
"name": "API Availability SLO",
"description": "Monitors the availability of our critical API endpoints",
"creator": "sre-team@example.com",
"target_threshold_percentage": 99.95,
"window": {
"slo_time_frame": "SLO_TIME_FRAME_28_DAYS"
},
"sli": {
"request_based_metric_sli": {
"good_events": {
"query": "sum(rate(http_requests_total{status=~\”2..\”})) by(service_name)"
},
"total_events": {
"query": "<total_events_metric_query>"
}
}
}
}
}
EOF
Example response:
{
"slo": {
"id": "b11919d5-ef85-4bb1-8655-02640dbe94d9",
"name": "API Availability SLO",
"description": "Monitors the availability of our critical API endpoints",
"creator": "sre-team@example.com",
"labels": {
"environment": "production",
"service": "api-gateway",
"team": "platform"
},
"revision": {
"revision": 1,
"update_time": "2024-03-20T10:00:00Z"
},
"grouping": {
"labels": ["environment", "service"]
},
"create_time": "2024-03-20T10:00:00Z",
"update_time": "2024-03-20T10:00:00Z",
"target_threshold_percentage": 99.95,
"window": {
"slo_time_frame": "SLO_TIME_FRAME_28_DAYS"
},
"sli": {
"request_based_metric_sli": {
"good_events": {
"query": "sum(rate(http_requests_total{status=~\”2..\”})) by(service_name)"
},
"total_events": {
"query": "<total_events_metric_query>"
}
}
}
}
}
ListSlos
Lists all available SLOs in the service catalog. It can be used with optional filters to retrieve SLO data.
Example request:
grpcurl -H "Authorization: Bearer API_KEY_HERE" -d @ https://ng-api-grpc.:443 com.coralogixapis.slo.v1.SlosService/ListSlos <<EOF
{
"filters": {
"filters": [
{
"field": {
"const_filter": "SLO_CONST_FILTER_FIELD_USER_NAME"
},
"predcate": {
"is": ["sre-team@example.com"]
}
},
{
"field": {
"label_name": "environment"
},
"predicate": {
"is": ["production", "staging"]
}
},
{
"field": {
"label_name": "service"
},
"predicate": {
"is": ["api-gateway"]
}
}
]
}
}
EOF
Example response:
{
"slos": [
{
"id": "c22020e6-fg96-5cc2-9766-13751cef05e0",
"name": "API Latency SLO",
"description": "Monitors the latency of our critical API endpoints",
"creator": "sre-team@example.com",
"labels": {
"environment": "staging",
"service": "api-gateway",
"team": "platform"
},
"revision": {
"revision": 1,
"update_time": "2024-03-20T11:00:00Z"
},
"grouping": {
"labels": ["environment", "service"]
},
"create_time": "2024-03-20T11:00:00Z",
"update_time": "2024-03-20T11:00:00Z",
"target_threshold_percentage": 99.9,
"window": {
"slo_time_frame": "SLO_TIME_FRAME_28_DAYS"
},
}
}
]
}
Support
Need help?
Our world-class customer success team is available 24/7 to walk you through your setup and answer any questions that may come up.
Feel free to reach out to us via our in-app chat or by sending us an email at support@coralogix.com.