Define Service Level Objectives
Service Levels Objectives in Reliably are defined in a
reliably.yaml manifest file. Below is an example manifest defining two objectives, api-availability and api-latency, each with its own SLO.
apiVersion: reliably.com/v1 kind: Objective metadata: labels: name: api-availability service: reliably-api spec: indicatorSelector: category: availability gcp_loadbalancer_name: example-lb gcp_project_id: example-id objectivePercent: 99 window: 1h0m0s --- apiVersion: reliably.com/v1 kind: Objective metadata: labels: name: api-latency service: reliably-api spec: indicatorSelector: category: latency gcp_loadbalancer_name: example-lb gcp_project_id: example-id latency_target: 300ms percentile: "99" objectivePercent: 99 window: 24h0m0s
SLOs are defined by the percentage of "good" events over a time window. You can use 1 hour, 1 day, 1 week, or 1 month preset observation windows, or define a custom one.
To define a observation windows construct a string representing a duration with the format:
Resources on AWS are identified with their Amazon Resource Name. Learn more about ARNs in the AWS documentation.
You can provide this information in the following format:
spec: indicatorSelector: aws_arn: arn:partition:service:region:account-id:resource-id
Google Cloud Platform resources
GCP resources are identified with a project ID, and the resource name.
spec: indicatorSelector: category: latency gcp_loadbalancer_name: example-lb gcp_project_id: example-id
The Reliably CLI can currently fetch Service Level Indicators for services that are attached to a Google Cloud Load Balancer. You will thus need a load balancer set up to define and report SLOs for GCP.
You can get the project ID and resource name from the gcloud CLI or the Google Cloud Console. #### gcloud CLI
The project ID can be found by running:
gcloud config get-value project
If you want to use a different project than the current one configured on your machine, list all of them with:
gcloud projects list
The resource name can be found with:
gcloud compute url-maps list
Google Cloud Console
The project ID can be found in the "Project info" card of your Google Cloud Console Dashboard.
The resource name can be found in the Network services / Load balancing section of the Google Cloud Console, where all your services attached to a load balancer are listed.
With the CLI
reliably slo init command can guide you through the creation of this file.
reliably slo init will prompt you with questions to help you
define an SLO.
? What is the name of the service you want to declare SLOs for? http-service
With Reliably, SLOs are attached to a service. You will first be asked to define a name for a service before you can define its SLOs.
? What type of SLO do you want to declare? [Use arrows to move, type to filter] > Availability Latency
You can choose either availability or latency SLOs. Availability SLOs are based on the success of a particular request. Latency SLOs are based on the completion of a request under a time threshold.
Target and latency threshold
? What is your target for this SLO (in %)? 99.9
You must specify a target for your SLO. This is what good looks like for your SLO and is expressed as a percentage. For example, for an Availability SLO, a target of 98% would mean 98% of the events were successfull.
If you select the latency SLO type, you will also be prompted to provide a threshold in milliseconds. All reponses within this threshold contribute to your target.
? What type of SLO do you want to declare? Latency ? What is your target for this SLO (in %)? 99.9 ? What is your latency threshold (in milliseconds)? 300
? What is your observation window for this SLO? [Use arrows to move, type to filter] > 1 hour 1 day 1 week 1 month custom
? What is your observation window for this SLO? custom ? Define your custom observation window [? for help]
If you want to measure your SLO and generate SLO reports, you will need to add a service resource. Service resources are resources from your cloud provider which Reliably uses to get your service level data.
? On which cloud provider? [Use arrows to move, type to filter] > Amazon Web Services Google Cloud Platform
Once you've selected a cloud provider, you will be asked to paste an resource identifier, or you can type
i to enter an interactive mode which will help you identify the service you want to get data from.
You will need to be authentified to Google Cloud or AWS for interactive mode to work.
Here is what interactive mode looks like for AWS:
? On which cloud provider? Amazon Web Services | Paste an AWS ARN, or type "i" for interactive mode. [? for help] | Select an AWS partition. [Use arrows to move, type to filter] > aws aws-cn aws-us-gov aws-iso aws-iso-b
? On which cloud provider? Amazon Web Services | Paste an AWS ARN, or type "i" for interactive mode. [? for help] | Select an AWS partition. aws | Select an AWS region. eu-west-3 | Select an AWS service. API Gateway | Select a Resource. simple-http-api (3tf7ct9s4y)
Here is what interactive mode looks like for Google Cloud:
? On which cloud provider? [Use arrows to move, type to filter] Amazon Web Services > Google Cloud Platform
? On which cloud provider? Google Cloud Platform | Select an Organization. [Use arrows to move, type to filter] > organization-name
? On which cloud provider? Google Cloud Platform | Select an Organization. chaosiq.io | Select an Project. Project One (project-one) | What is the 'type' of the resource? Google Cloud Load Balancers | Select a resource. staging-lb
You will then be asked if you want to add another service for this SLO. Answering Yes will trigger the same set of questions.
? Do you want to add another resource for measuring your SLI? (y/N)
Once your SLOs in defined, you will be asked to name it. The Reliably CLI will suggest you with a name based upon how you described your SLO. Press
Enter to keep this name, or type one which suits you better.
? What is the name of this SLO? (99.9% of requests faster than 300ms over last 1 day)
Additional SLOs and Services
You will then be asked if you want to add more SLOs to this service, then if you want to add more services to your manifest.
When you're done, the CLI will confirm your manifest has been successfully created in your working directory.
✓ Your manifests has been saved to ./reliably.yaml
The manifest file will also uploaded to the Reliably SaaS. The local
reliably.yamlfile will be used to
generate your SLO report.
Measure and Report
Now that your SLOs are defined, the Reliably CLI will be able to query the resources for SLIs and generate SLO reports.
Read the Reliably CLI SLO Init command reference for a complete list of options.