When creating a Service Level Objective (SLO), you must define a service level indicator (SLI) that your SLO will use to evaluate your level of success.
To identify a suitable SLI:
Express your SLI in terms of user goals. For example, “a user should be able to load our home page and see a result quickly”.
Identify qualified events, which are events that contain information about the SLI.
In this example, qualified events are events where request.path = "/home"
.
For events that are not qualified, Honeycomb returns null
.
Establish the criterion you will use to determine which qualified events you consider as “successful”.
In this example, success means duration_ms < 100
.
Honeycomb evaluates “success” according to your definition.
For each event in the Dataset, the SLI returns true
(success), false
(failure), or null
(not applicable).
In other words, a SLI is defined as the number of successful events divided by the total (valid) events, and multiplied by 100 for a resulting percentage.
SLIs are represented as Derived Columns in Honeycomb, and thus visible after creation as a field in your schema, in Query Builder, or in Triggers. SLIs can be created using the Derived Column creation workflow in Dataset Settings, but this creation experience is not optimized for SLIs.
Instead, when creating your SLO, use the New SLI workflow as outlined below.
To define your SLI, we recommend creating your SLI during the SLO creation process.
Two options exist to define your SLI:
You can switch from Build Query mode to Write Formula mode. Returning to Build Query mode from Write Formula mode removes any entered syntax.
To use query syntax to define your SLI, create a new SLI and select Build Query:
During the SLO creation process, select + New SLI:
In the New Service Level Indicator (SLI) window, enter a Display Name, which will appear elsewhere as a field name in the Query Builder.
Enter a display name that is unique across the Dataset and its containing Environment. Your SLI name should not match the name of any other Derived Column or any other field in any Dataset contained within the Environment.
Although Honeycomb tries to prevent duplicate field names, they can still occur. To learn more about behaviors related to name collision and solutions, visit Common Issues with Queries: Derived Columns.
Optionally, include a description for your SLI.
Select Build Query to use Honeycomb’s query language and to define filters for total and successful events.
Following our previous example, this SLI’s query syntax for each filter would be:
Total (valid) events: request.path = /home
Successful events: http:response_duration < 100
Optionally, use the Preview Data section to preview the results of the function. Sample data from recent events helps you to verify the expression before it is saved.
Select Save and continue creating your SLO.
To use derived column syntax to define your SLI, create a new SLI and select Write Formula:
During the SLO creation process, select + New SLI.
In the New Service Level Indicator (SLI) window, enter a Display Name, which will appear elsewhere as a field name in the Query Builder.
Enter a display name that is unique across the Dataset and its containing Environment. Your SLI name should not match the name of any other Derived Column or any other field in any Dataset contained within the Environment.
Although Honeycomb tries to prevent duplicate field names, they can still occur. To learn more about behaviors related to name collision and solutions, visit Common Issues with Queries: Derived Columns.
Optionally, include a description for your SLI.
Select Write Formula and define the Derived Column formula for your SLI.
Most SLIs are written using Honeycomb’s two-argument “IF” command: IF(qualifier, criterion)
.
With this command, IF( $a, $b)
returns $b
only if $a
is true
.
Otherwise, it returns null
.
Following our previous example, the Derived Column formula for this SLI would be:
IF( EQUALS( $request.path, "/home"), LT( $http.response_duration, 100))
To explore more examples of formulas for SLIs, visit SLI Formulas.
To learn more about syntax and available functions, visit Derived Column Formula Reference.
Optionally, use the Preview Data section to preview the results of the function. Sample data from recent events helps you to verify the expression before it is saved.
Select Save and continue creating your SLO.
Use the chart below to translate between Derived Column syntax in Write Formula mode and Query syntax in Build Query mode.
Derived Column Function | Query Syntax |
---|---|
LT() | < |
LTE() | <= |
GT() | > |
GTE() | >= |
EQUALS() / NOT(EQUALS()) | =, != |
IN() / NOT(IN()) | in, not-in |
EXISTS() / NOT(EXISTS()) | exists, does-not-exist |
STARTS_WITH() / NOT(STARTS_WITH()) | starts-with, does-not-start-with |
ENDS_WITH() / NOT(ENDS_WITH()) | ends-with, does-not-end-with |
CONTAINS() / NOT(CONTAINS()) | contains, does-not-contain |
Referencing another Derived Column from a SLI (or Derived Column) is not supported.
To test your SLI:
From the left navigation menu, select Query.
Query the dataset that contains your SLO.
VISUALIZE | GROUP BY |
---|---|
COUNT HEATMAP(duration_ms) |
<SLI derived column> |
In your results, confirm that three groups exist: true
(successful qualified events), false
(failed qualified events), and blank (events that are not qualified).
Confirm that the three groups look correct for your use case and understanding of the dataset’s contents.
To explore this process in more detail, read our Working Toward Service Level Objectives blog post.