The Service-Level Objective (SLO) configuration specifies a target value or range of values for a service level that is measured by Service-Level Indicators (SLI).
Example of Service-Level Objective (SLO):
spec_version: '1.0' filter: mz_id: "4711" svc_id: "a14b-cd87-0d51" comparison: compare_with: "single_result" include_result_with_score: "pass" aggregate_function: avg objectives: - sli: response_time_p95 pass: - criteria: - "<=+10%" - "<1000" warning: - criteria: - "<=800" total_score: pass: "90%" warning: "75%"
This property allows a list of key-value pairs that are used to uniquely identify a deployment of a service. This means that the key of a filter can be used as a placeholder in an SLI query. For example, the filter
svc_id: "a14b-cd87-0d51" specifies a unique identifier of the deployment of a service. Consequently, the key of the filter (i.e.,
svc_id) can be referenced in an SLI query by
The filters project, stage, service, and deployment can be inferred from the Keptn configuration by using
$DEPLOYMENT in SLI queries respectively. These values can also be overwritten in the configuration. The default filters are:
Example of an SLO with a list of filters:
spec_version: '1.0' filter: mz_id: "4711" svc_id: "a14b-cd87-0d51" comparison: ...
Example of an SLI with reference to the
mz_id filter from the SLO:
spec_version: "1.0" indicators: throughput: "builtin:service.requestCount.total:merge(0):count?scope=tag(keptn_service:$SERVICE),mzId($mz_id)"
By default, Keptn compares with the previous values of the SLIs. To support more advanced comparion strategies, the following properties are available:
The compare_with config parameter controls how many previous results are compared:
The number_of_comparison_results config parameter configures the actual number of previous results if
compare_with is set to
The include_result_with_score config parameter controls which of the previous results are included in the comparison:
all is the default, also used if not specified).
Note: If you configure
compare_with: "single_result" in combination with number_of_comparison_results, compare_with will negate the number_of_comparison_results.
comparison: compare_with: "single_result" include_result_with_score: "pass" aggregate_function: avg
This comparison configuration means that the current result is only compared to the last result that passed.
comparison: compare_with: "several_results" number_of_comparison_results: 3 include_result_with_score: "pass_or_warn" aggregate_function: "avg"
This comparison configuration means that the current result is compared to the average of the three previous results that had pass or warning as a result.
An objective consists of:
weighthas a value of 1 for all SLIs and can be overwritten. The weight is important for calculating the total score.
Configuring the criteria:
The pass and warning criteria allow a list of boolean expressions with a logical operator [<, <=, >, >=] and a absolute or relative value. While the absolute value is a numberical number, the realtive value requires a (+/-) at the beginning and a % sign at the end, e.g.:
pass: - criteria: - "<1000" - "<=+10%"
pass: - criteria: - "<1000" - criteria: - "<=+10%"
Example of an Objective:
objectives: - sli: response_time_p95 pass: - criteria: - "<=+10%" - "<1000" warning: - criteria: - "<=800" weight: 2 key_sli: true
An evaluation for pass counts for one point, an evaluation for warning half a point, and an evaluation for fail zero points. The default weight of an SLI is 1 and can be overwritten. The maximum score is the sum of the weights of all SLIs.
The actual evaluation result is divided by the maximum score and gives the
total_score in percent. For example, the maximum score is 92 and the evaluation result is 85 - the
total_score is 92.39% (85⁄92*100).
The pass and warning criteria for the
total_score use the logical operator “>=” by default.
Important: In the following command, the value of the
resourceUri must be set to
keptn add-resource --project=sockshop --stage=staging --service=carts --resource=slo-quality-gates.yaml --resourceUri=slo.yaml