-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changing latency slo format to match sloth and adding unti tests and …
…make target
- Loading branch information
Showing
8 changed files
with
491 additions
and
395 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
## SLO Multi burn rate multi window alerts | ||
Kuadrant have created two example SLO alerts to help give ideas on the types of SLO alerts that could be used with the operator. We have created one alert for latency and one for availability, both are Multiwindow, Multi-Burn-Rate Alerts. The alerts show a scenario where a 28d rolling window is used and a uptime of 99.95% i.e only .1% error margin is desired. This in real world time would be downtime of around. These values can be changed to suit different scenarios | ||
|
||
| Time Frame | Duration | | ||
|------------|------------| | ||
| Daily: | 43s | | ||
| Weekly: | 5m 2.4s | | ||
| Monthly: | 21m 44s | | ||
| Quarterly: | 1h 5m 12s | | ||
| Yearly: | 4h 20m 49s | | ||
|
||
### Sloth | ||
Sloth is a tool to aid in the creation of multi burn rate and multi window SLO alerts and was used to create both the availability and latency alerts. It follows the common standard set out by [Google's SRE book](https://sre.google/workbook/implementing-slos/). Sloth generates alerts based on specific specs given. The specs for our example alerts can be found in the example/sloth folder. | ||
|
||
#### Metrics used for the alerts | ||
|
||
#### Availability | ||
For the availability SLO alerts the Istio metric `istio_requests_total` was used as its a counter type metric meaning the values can only increase as well as it gives information on all requests handled by the Istio proxy. | ||
|
||
#### Latency | ||
For the availability SLO alerts the Istio metric 'istio_requests_total' was used as its a Distribution type metric meaning values are mapped to different ranges of frequency's as well as it gives information duration of requests. | ||
|
||
### Sloth generation | ||
You can modify the examples Sloth specs we have and regenerate the prometheus rules using the Sloth CLI and the generate command. For more information please the [Sloth website](https://sloth.dev/usage/cli/) | ||
|
||
``` | ||
generate -i examples/alerts/sloth/latency.yaml --default-slo-period=28d | ||
``` | ||
|
||
### Prometheus unit tests | ||
There are also two matching unit tests to verify and test the alerts that Sloth has generated. These can be run using the make target: | ||
|
||
``` | ||
make alerts-tests | ||
``` |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,4 +23,4 @@ slos: | |
ticket_alert: | ||
labels: | ||
severity: warning | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
export WORKDIR ?= $(shell pwd) | ||
export IMAGE ?= quay.io/prometheus/prometheus | ||
export AVAILABILITY_SLO_RULES ?= ${WORKDIR}/examples/alerts/slo-availability.yaml | ||
export LATENCY_SLO_RULES ?= ${WORKDIR}/examples/alerts/slo-latency.yaml | ||
export UNIT_TEST_DIR ?= ${WORKDIR}/examples/alerts/tests | ||
|
||
|
||
|
||
container-runtime-tool: | ||
$(eval CONTAINER_RUNTIME_BIN := $(shell if command -v docker &>/dev/null; then \ | ||
echo "docker"; \ | ||
elif command -v podman &>/dev/null; then \ | ||
echo "podman"; \ | ||
else \ | ||
echo "Neither Docker nor Podman is installed. Exiting..."; \ | ||
exit 1; \ | ||
fi)) | ||
|
||
|
||
alerts-tests: container-runtime-tool | ||
$(CONTAINER_RUNTIME_BIN) run --rm -t \ | ||
-v $(AVAILABILITY_SLO_RULES):/prometheus/slo-availability.yaml \ | ||
-v $(LATENCY_SLO_RULES):/prometheus/slo-latency.yaml \ | ||
-v $(UNIT_TEST_DIR):/prometheus/tests --entrypoint=/bin/sh \ | ||
$(IMAGE) -c 'tail -n +7 slo-latency.yaml > latency-rules.yaml && tail -n +7 slo-availability.yaml > availability-rules.yaml && cd tests && promtool test rules *' |