sloth-service-levels
by Helm
Sloth PrometheusServiceLevels templates
About this chart
Sloth Prometheus Service Levels
This chart provides some basic templates for generating common SLI/SLOs for your services.
By now only service availability and latency are provided. The idea is that on every project we want to have SLI/SLOs we use this chart as dependency, and filling some values you'll end up with some valid metrics for measure the health of your service.
Dependencies
For deploying this there's the dependency of the Sloth operator and its CRDs. It should be already installed in all our Kubernetes clusters before start using this, this is on charge of the SRE team which installs it via the App of Apps pattern.
Deploy Definition: https://bitbucket.org/softonic-development/argocd-apps-manifests/src/main/tooling/sloth-sli-slo/ Project configuration: https://bitbucket.org/softonic-development/sloth-sli-slo/src/master/
Usage
Just add this chart as dependency to your project:
dependencies:
- name: sloth-service-levels
version: 1.0.0
# repository: @softonic (private repo)
repository: https://chartmuseum.softonic.io
Local test
You can see the output of the PrometheusServiceLevel resource executing the next command:
helm upgrade --install --namespace my-namespace my-release \
-f values.yaml \
-f values.test.yaml \
. \
--debug --dry-run
Example of generated template
# Source: sloth-service-levels/templates/prometheusservicelevel.yaml
# The service level has 2 SLOs based on service requests/responses.
#
# We consider an SLI event the requests made to the server, lets review the SLOs
#
# - `requests-availability`
# - This SLO warn us that we are returning correctly the requests to the clients
# - SLI error: We consider a bad request (event) a request with the codes >=500
# - SLO objective (99.9%): We are restrictive with this because we only allow failing a request every 1000.
#
# - `requests-latency`
# - This SLO warn us that the service responses are being slow and this will affect the clients
# - SLI error: We consider a bad request (event) when the response latency is >500ms.
# - SLO objective(95%): This means that we will have a problem when more than the 5% of the queries are slower than the SLI error
# Source: sloth-service-levels/templates/prometheusservicelevel.yaml
# Source: sloth-service-levels/templates/prometheusservicelevel.yaml
apiVersion: sloth.slok.dev/v1
kind: PrometheusServiceLevel
metadata:
name: my-service-level
labels:
helm.sh/chart: sloth-service-levels-1.0.0
app.kubernetes.io/version: "0.10.0"
app.kubernetes.io/managed-by: Helm
annotations:
useful/for/me: just-a-value
spec:
service: my-service
labels:
softonic.io/owner: owner-team
softonic.io/repo: repo-namespace/repo-name
softonic.io/service: my-service
softonic.io/site: my-site
tier: 2
slos:
- name: requests-availability
objective: 99.9
description: "Common SLO based on availability for HTTP request responses"
sli:
events:
errorQuery:
sum(rate(istio_request_duration_milliseconds_count{destination_workload_namespace="my-namespace",response_code=~"(5..)"}[{{.window}}]))
totalQuery:
sum(rate(istio_request_duration_milliseconds_count{destination_workload_namespace="my-namespace"}[{{.window}}]))
alerting:
pageAlert:
disable: true
ticketAlert:
disable: true
- name: requests-latency
objective: 95
description: "Rate of requests that take less than .5 seconds"
sli:
events:
errorQuery:
(
sum(rate(istio_request_duration_milliseconds_count{reporter="source", destination_workload_namespace="my-namespace"}[{{.window}}]))
-
sum(rate(istio_request_duration_milliseconds_bucket{le="500",reporter="source", destination_workload_namespace="my-namespace"}[{{.window}}]))
)
totalQuery:
sum(rate(istio_request_duration_milliseconds_count{reporter="source", destination_workload_namespace="my-namespace"}[{{.window}}]))
alerting:
annotations:
summary: High latency rate on 'my-service' requests responses
labels:
category: latency
name: MyServiceLatencyAlert
pageAlert:
labels:
severity: warning
ticketAlert:
labels:
severity: warning
slack_channel: '#alert-test'
TODO
Provide more examples and default values to be used as examples.
Deploy sloth-service-levels with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has sloth-service-levels on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartsloth-service-levels is pinned at v1.0.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply