SLIs & SLOs via Dynatrace Dashboard
Based on user feedback we learned that defining custom SLIs via the sli.yaml and then defining SLOs via slo.yaml can be challenging as one has to be familiar with the Dynatrace Metrics v2 API to craft the necessary SLI queries. As dashboards are a prominent feature in Dynatrace to visualize metrics, it was a logical step to leverage dashboards as the basis for Keptn’s SLI/SLO configuration.
Use Cases
SLI/SLO Dashboard Layout and how it generates SLI & SLO definitions
Here is a sample dashboard for our simplenode sample application:
And here is how the individual pieces matter:
1. Name of the dashboard
project=<project>,service=<service>,stage=<stage>
2. Management zone Filter
If you are building a dashboard specific to an application or part of your environment, it is a good practice to set a default management zone filter for your dashboard.
3. Markdown with SLO Definitions
The dashboard is not only used to define which metrics should be evaluated (list of SLIs), it is also used to define the individual SLOs and global settings for the SLO, e.g., Total Score goals or Comparison Rules. These are settings you normally have in your slo.yaml. To specify those settings simply create a markdown that contains name-value pairs like in the example dashboard.
KQG.Total.Pass=90%;KQG.Total.Warning=75%;KQG.Compare.WithScore=pass;KQG.Compare.Results=1;KQG.Compare.Function=avg
4. Tiles with SLI definition
Similar to the markdown, each tile can define several configuration elements. The only mandatory is sli=sliprefix. Here a couple of examples of possible values. It actually starts with a human readable value that is not included in the analysis but makes the dashboard easier readable:
Test Step Response Time;sli=teststep_rt;pass=<500;warning=<1000;weight=2
Process Memory;sli=process_memory
Response time (P50);sli=svc_rt_p95;pass=<+10%,<500
5. SLI Dashboard also supports SLO tiles and Problem Tiles.
6. USQL Tiles
This all seems a little complex.
Good news, for the lab exercise, we have created a SLI dashboard template.
We have also created the secret in keptn to allow the dashbaord integration.
- open ssh
- change to the root user
- execute
#: sudo su -
Use the password from your lab environments page.
- execute
- validate the environment variables
- execute
#: env
we are looking for these environment variables:
- DT_TENANT
- DT_API_TOKEN
- KEPTN_DOMAIN
If These are not set, then we will need to set them, A instructor will help you find these values.
- execute
#: export DYNATRACE_TENANT=<DYNATRACE_TENANT> #: export DT_API_TOKEN=<DT_API_TOKEN> #: export KEPTN_DOMAIN=<KEPTN_DOMAIN>
- execute
- Next, navigate to this directory, ~/keptn-in-a-box/resources/dynatrace/scripts
- execute
#: cd /home/dtu_training/keptn-in-a-box/resources/dynatrace/scripts
- execute
- Run the script setdbenv.sh
- execute
#: ./setdbenv.sh <domain>
You can find your domain by navigating to the lab home page.
- execute
Next
Go to your Dynatrace tenant and click on “Dashboards”.
The Dashbaord we are looking for is labeled “KQG;project=sockshop;stage=staging;service=carts”
- Toggle on “Show all tenant dashboards”
- Clone the dashbaord
- Select the cloned dashboard
- rename the dashboard
- click edit
- click the “pencil” icon for the dashbaord header
- remove “-clone” from the header then click the “check-mark”
Now if you navigate back to dashbaords, you should see this dashbaord with the student id as the owner.
select the dashbaord.
If not done previously, We need to create a rule on the management zone that keptn created.
In the Dynatrace UI, navigate to “Settings>Preferences>Management zones” Now, locate the “Keptn: sockshop staging” management zone.
Create this rule on the management zone.
Next, create the SLO
We need to configure the SLO tiles on the Dashboard.
- make sure you have selected the “keptn: sockshop staging” management zone.
- Go to “Service-level objectives”
- Create the SLO type “Service-level availability”
- set timeframe to “Last 30 minutes”
- use “mzName(“Keptn: sockshop staging”),type(“SERVICE”)” as the entity selector
- Now navigate back to the dashboard
- Click edit
- Select the SLO tile
- pick the SLO you just created from the drop down
- click “Done”
Now you should data in the SLO tile.
Next, Execute the evaluation
Go to Jenkins and run the “06-qualitygate-sli-dashboard”.
Or
We can trigger the evaluation by using the keptn web service
Give it a few minutes to see the evaluation performed in the Keptn bridge.
We can see the evaluation for the SockShop project.
Drilling into the project, we can navigate to the Cart Service Heatmap.
This will show all the SLI’s from the dashbaord and the overall SLO scores.
Summary
- How one can setup a dashbaord for SLI/SLO evaluations