[Live Webinar] Next-Level O11y: Why Every DevOps Team Needs a RUM Strategy Register today!

Back to All Docs

SLO Management API

Last Updated: Jan. 23, 2024

Overview

We are introducing the SLO API to enable teams, particularly those not utilizing a UI, to efficiently manage their SLOs programmatically. This API will let you retrieve, read, create, update and delete your SLOs.

Prerequisites

API Endpoints

This reference document lists example requests and responses using gRPCurl. The following calls accept arguments as JSON in the request body and return results as JSON in the response body. A complete list of Management Endpoints is available here.

Authentication

Coralogix API uses API keys to authenticate requests. You can view and manage your API keys from the Data Flow tab in Coralogix. You need to use an API key in the Authorization request header to successfully connect.

Example:

grpcurl -H "Authorization: Bearer API_KEY_HERE"

Then, use one of our designated Management Endpoints to structure your header.

-d @ ng-api-grpc.coralogix.com:443

For SLO API, the service name will be ServiceSloService.

com.coralogixapis.apm.services.v1.ServiceSloService/

The complete request header should look like this:

grpcurl -H "Authorization: Bearer API_KEY_HERE" -d @ ng-api-grpc.coralogix.com:443 com.coralogixapis.apm.services.v1.ServiceSloService/

ListServiceSlos

Lists all available SLOs from the entire service catalog. In this example, there are two available SLOs, List_bigger_than_10ms from productcatalogservice and Latency_bigger_then_1ms from the frontend service. Here you will find the id field associated with each SLO.

REQUEST

grpcurl -H "Authorization: Bearer API_KEY_HERE" -d @ ng-api-grpc.coralogix.com:443 com.coralogixapis.apm.services.v1.ServiceSloService/ListServiceSlos <<EOF
{
}
EOF

RESPONSE

{
  "slos": [
    {
      "id": "049b684b-4ef0-449e-8fad-33e5f90775b4",
      "name": "List_bigger_than_10ms",
      "serviceName": "productcatalogservice",
      "description": "Check if the operation of list products is bigger than 10ms for 50% of the spans",
      "targetPercentage": 50,
      "createdAt": "1970-01-20T11:38:56.476Z",
      "remainingErrorBudgetPercentage": 100,
      "latencySli": {
        "thresholdMicroseconds": "10000",
        "thresholdSymbol": "THRESHOLD_SYMBOL_GREATER_OR_EQUAL"
      },
      "filters": [
        {
          "field": "operationname",
          "compareType": "COMPARE_TYPE_IS",
          "fieldValues": [
            "hipstershop.ProductCatalogService/ListProducts"
          ]
        }
      ],
      "period": "SLO_PERIOD_7_DAYS"
    },
    {
      "id": "089d1831-7c40-4a31-bab8-0f64116c18b2",
      "name": "Latency_bigger_then_1ms",
      "serviceName": "frontend",
      "description": "Check if latency is bigger then 1ms ",
      "targetPercentage": 1,
      "createdAt": "1970-01-20T11:40:32.323Z",
      "remainingErrorBudgetPercentage": 100,
      "latencySli": {
        "thresholdMicroseconds": "1000",
        "thresholdSymbol": "THRESHOLD_SYMBOL_GREATER_OR_EQUAL"
      },
      "period": "SLO_PERIOD_7_DAYS"
    }
  ]
}

GetServiceSlo

Retrieves specific SLO information for a given service. In this example, you are retrieving all SLOs for the frontendservice. You need to provide the SLO id.

REQUEST

grpcurl -H "Authorization: Bearer API_KEY_HERE" -d @ ng-api-grpc.coralogix.com:443 com.coralogixapis.apm.services.v1.ServiceSloService/GetServiceSlo <<EOF
{
    "id": "049b684b-4ef0-449e-8fad-33e5f90775b4"
}
EOF

RESPONSE

{
  "slo": {
    "id": "049b684b-4ef0-449e-8fad-33e5f90775b4",
    "name": "List_bigger_than_10ms",
    "serviceName": "productcatalogservice",
    "description": "Check if the operation of list products is bigger than 10ms for 50% of the spans",
    "targetPercentage": 50,
    "createdAt": "1970-01-20T11:38:56.476Z",
    "remainingErrorBudgetPercentage": 100,
    "latencySli": {
      "thresholdMicroseconds": "10000",
      "thresholdSymbol": "THRESHOLD_SYMBOL_GREATER_OR_EQUAL"
    },
    "filters": [
      {
        "field": "operationname",
        "compareType": "COMPARE_TYPE_IS",
        "fieldValues": [
          "hipstershop.ProductCatalogService/ListProducts"
        ]
      }
    ],
    "period": "SLO_PERIOD_7_DAYS"
  }
}

BatchGetServiceSlos

Retrieves specified SLOs from the list. You need to provide the id for each required SLO. In this example, we are retrieving List_bigger_than_10ms and Latency_bigger_than_1ms.

REQUEST

grpcurl -H "Authorization: Bearer API_KEY_HERE" -d @ ng-api-grpc.coralogix.com:443 com.coralogixapis.apm.services.v1.ServiceSloService/BatchGetServiceSlos <<EOF
{
  "ids": ["049b684b-4ef0-449e-8fad-33e5f90775b4", "089d1831-7c40-4a31-bab8-0f64116c18b2"]
}
EOF

RESPONSE

{
  "slos": {
    "049b684b-4ef0-449e-8fad-33e5f90775b4": {
      "id": "049b684b-4ef0-449e-8fad-33e5f90775b4",
      "name": "List_bigger_than_10ms",
      "serviceName": "productcatalogservice",
      "description": "Check if the operation of list products is bigger than 10ms for 50% of the spans",
      "targetPercentage": 50,
      "createdAt": "1970-01-20T11:38:56.476Z",
      "remainingErrorBudgetPercentage": 100,
      "latencySli": {
        "thresholdMicroseconds": "10000",
        "thresholdSymbol": "THRESHOLD_SYMBOL_GREATER_OR_EQUAL"
      },
      "filters": [
        {
          "field": "operationname",
          "compareType": "COMPARE_TYPE_IS",
          "fieldValues": [
            "hipstershop.ProductCatalogService/ListProducts"
          ]
        }
      ],
      "period": "SLO_PERIOD_7_DAYS"
    },
    "089d1831-7c40-4a31-bab8-0f64116c18b2": {
      "id": "089d1831-7c40-4a31-bab8-0f64116c18b2",
      "name": "Latency_bigger_then_1ms",
      "serviceName": "frontend",
      "description": "Check if latency is bigger then 1ms ",
      "targetPercentage": 1,
      "createdAt": "1970-01-20T11:40:32.323Z",
      "remainingErrorBudgetPercentage": 100,
      "latencySli": {
        "thresholdMicroseconds": "1000",
        "thresholdSymbol": "THRESHOLD_SYMBOL_GREATER_OR_EQUAL"
      },
      "period": "SLO_PERIOD_7_DAYS"
    }
  }
}

CreateServiceSlo

Creates a new SLO with given configuration for a chosen service. In this example, you are creating the frontendtestSLO for a frontend service.

REQUEST

grpcurl -H "Authorization: Bearer API_KEY_HERE" -d @ ng-api-grpc.coralogix.com:443 com.coralogixapis.apm.services.v1.ServiceSloService/CreateServiceSlo <<EOF
{
  "slo": {
    "name": "frontendtest",
    "serviceName": "frontend",
    "description": "Sample description for your SLO",
    "targetPercentage": 95,
    "errorSli": {
    },
    "period": "SLO_PERIOD_7_DAYS"
  }
}
EOF

RESPONSE

{
  "slo": {
    "id": "0416396c-a1ad-46d8-a10c-a05ea15dc3af",
    "name": "frontendtest",
    "serviceName": "frontend",
    "description": "Sample description for your SLO",
    "targetPercentage": 95,
    "createdAt": "1970-01-20T17:43:33.485Z",
    "remainingErrorBudgetPercentage": 100,
    "errorSli": {},
    "period": "SLO_PERIOD_7_DAYS"
  }
}

ReplaceServiceSlo

Updates an SLO with new field entries for a chosen service. In this example, you are replacing the description content for a frontend service SLO. The SLO is supposed to check for errors in the frontend.

REQUEST

grpcurl -H "Authorization: Bearer API_KEY_HERE" -d @ ng-api-grpc.coralogix.com:443 com.coralogixapis.apm.services.v1.ServiceSloService/ReplaceServiceSlo <<EOF
{
  "slo": {
    "id": "0416396c-a1ad-46d8-a10c-a05ea15dc3af",
    "name": "frontendtest",
    "serviceName": "frontend",
    "description": "Checks for frontend errors.",
    "targetPercentage": 95,
    "errorSli": {},
    "period": "SLO_PERIOD_7_DAYS"
  }
}
EOF

RESPONSE

"slo": {
    "id": "0416396c-a1ad-46d8-a10c-a05ea15dc3af",
    "name": "frontendtest",
    "serviceName": "frontend",
    "description": "Checks for frontend errors.",
    "targetPercentage": 95,
    "createdAt": "1970-01-20T17:43:33.485Z",
    "remainingErrorBudgetPercentage": 100,
    "errorSli": {},
    "period": "SLO_PERIOD_7_DAYS"
  }
}

DeleteServiceSlo

Deletes a specified SLO for a given service. In this example, you are deleting the frontendtest SLO from the frontendservice.

REQUEST

grpcurl -H "Authorization: Bearer API_KEY_HERE" -d @ ng-api-grpc.coralogix.com:443 com.coralogixapis.apm.services.v1.ServiceSloService/DeleteServiceSlo <<EOF
{
    "id": "0416396c-a1ad-46d8-a10c-a05ea15dc3af"
}
EOF

RESPONSE

{}

Body Parameters

FieldTypeDefinition
idint32Unique identifier for the Service Level Objective (SLO).
idsarrayList of service SLO IDs to retrieve.
slosarrayList of Service Level Objectives (SLOs) with their respective
details.
namestringName of the SLO.
serviceNamestringService name associated with the SLO.
descriptionstringDescription of the SLO.
targetPercentageintegerTarget percentage for the SLO.
createdAttimestampTimestamp indicating when the SLO was created.
remainingErrorBudgetPercentageintegerRemaining error budget percentage.
errorSlibooleanIndicates the presence of an error SLI.
latencySliarrayDefines SLI threshold and relationship.
latencySli.thresholdMicrosecondsstringThreshold in microseconds for latency.
latencySli.thresholdSymbolenumSymbol indicating the threshold relationship (e.g.,
GREATER_OR_EQUAL).
filters.fieldstringField for the filter.
filters.compareTypeenumType of comparison (e.g., IS, START_WITH).
filters.fieldValuesstringList of field values for the filter.
periodenumPeriod for the SLO (e.g., 7 days, 14 days).

CompareType

NameNumberDescription
COMPARE_TYPE_UNSPECIFIED0Filter entry is unspecified
COMPARE_TYPE_IS1Filters for a specific entry.
COMPARE_TYPE_START_WITH2Filters for results that start with the entry.
COMPARE_TYPE_ENDS_WITH3Filters for results that end with the entry.
COMPARE_TYPE_INCLUDES4Filters for a result that includes the entry.

ThresholdSymbol

NameNumberDescription
THRESHOLD_SYMBOL_UNSPECIFIED0Threshold criterion is not given.
THRESHOLD_SYMBOL_GREATER1Threshold criterion is greater than the specified number.
THRESHOLD_SYMBOL_GREATER_OR_EQUAL2Threshold criterion is greater than or equal to the specified number.
THRESHOLD_SYMBOL_LESS3Threshold criterion is less than the specified number.
THRESHOLD_SYMBOL_LESS_OR_EQUAL4Threshold criterion is less than or equal to the specified number.
THRESHOLD_SYMBOL_EQUAL5Threshold criterion is equal to the specified number.
THRESHOLD_SYMBOL_NOT_EQUAL6Threshold criterion is not equal to the specified number.

SloPeriod

NameNumberDescription
SLO_PERIOD_UNSPECIFIED0Time period for which the SLO measures results is unspecified.
SLO_PERIOD_7_DAYS1Time period for which the SLO measures results is 7 days.
SLO_PERIOD_14_DAYS2Time period for which the SLO measures results is 14 days.
SLO_PERIOD_30_DAYS3Time period for which the SLO measures results is 30 days.

On this page

Live Webinar
Next-Level O11y: Why Every DevOps Team Needs a RUM Strategy
April 30th at 12pm ET | 6pm CET
Save my Seat