{"id":26780495,"url":"https://github.com/kaihendry/slo","last_synced_at":"2026-02-23T01:30:57.630Z","repository":{"id":142044461,"uuid":"217959342","full_name":"kaihendry/slo","owner":"kaihendry","description":"Prometheus instrumentation \u0026 metrics tutorial","archived":false,"fork":false,"pushed_at":"2024-10-21T22:33:05.000Z","size":78,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-20T07:40:59.287Z","etag":null,"topics":["kubernetes","metrics","performance-monitoring","prometheus","prometheus-metrics","tutorial"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/repository/docker/hendry/slo","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kaihendry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-10-28T03:30:31.000Z","updated_at":"2024-10-01T19:13:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"fdabd164-06b5-47d3-ad8c-0c999874c799","html_url":"https://github.com/kaihendry/slo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kaihendry/slo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaihendry%2Fslo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaihendry%2Fslo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaihendry%2Fslo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaihendry%2Fslo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaihendry","download_url":"https://codeload.github.com/kaihendry/slo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaihendry%2Fslo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29734468,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T20:09:16.275Z","status":"ssl_error","status_checked_at":"2026-02-22T20:09:13.750Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kubernetes","metrics","performance-monitoring","prometheus","prometheus-metrics","tutorial"],"created_at":"2025-03-29T07:16:53.988Z","updated_at":"2026-02-23T01:30:57.264Z","avatar_url":"https://github.com/kaihendry.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Service Level Objective (SLO) tutorial for Kubernetes 🐢\n\nGoal is to show how to derive a Service Level Objective measure on a Kubernetes service \"slo\" using Prometheus metrics.\n\nSLOs help teams create API **performance goals** and measure how well they are\nmeeting those goals.\n\nThe three pillars of observability are logs, metrics, and traces. The aim of this code is to show how **metrics** [are instumented](https://github.com/prometheus/client_golang), exported (kind: LoadBalancer), scraped (kind: PodMonitor) and queried (Prometheus Operator).\n\n# Quickstart\n\n1. `brew install colima hey helm` - install the tools\n2. Give colima a bit more memory than defaults: `colima start --cpu 4 --memory 8`\n3. Start Kubernetes cluster: `colima kubernetes start`\n4. Install the [kube-prometheus-stack](https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack)\n\n```bash\nhelm repo add prometheus-community https://prometheus-community.github.io/helm-charts\nhelm repo update\nhelm install tutorial prometheus-community/kube-prometheus-stack --set prometheus.prometheusSpec.podMonitorSelectorNilUsesHelmValues=false\n```\n\n5. `kubectl apply -f k8s/deploy.yaml` to deploy the \"slo\" service\n6. Export prometheus service to localhost: `kubectl port-forward service/tutorial-kube-prometheus-s-prometheus 9090:9090`\n7. Expose slo level 4 load balancer to localhost: `kubectl port-forward svc/slo-service 8080:8080`\n8. `hey http://localhost:8080/` - generate 200 requests to the service\n9. `hey \"http://localhost:8080/?sleep=500\"` - simulate 200 SLOW 🐢 responses frim the service\n\nWith a [Application Performance Index](https://en.wikipedia.org/wiki/Apdex) aka SLO query in Prometheus:\n\n    sum(rate(request_duration_seconds_bucket{le=\"0.3\"}[5m])) by (job)\n    /\n    sum(rate(request_duration_seconds_count[5m])) by (job)\n\n[Documentation on these queries](https://prometheus.io/docs/practices/histograms/)\n\nIt should say 50% (0.5) of requests are under 300ms in the last 5 minutes. You\nmight **need to be patient** for the metrics to appear, as the /metrics\nendpoints might not have been scraped by Prometheus yet.\n\n![image](https://github.com/kaihendry/slo/assets/765871/6ebcb036-1da6-4489-ad66-207ae94a7208)\n\n# Other resources\n\n* https://github.com/kaihendry/pingprom - Prometheus quickstart with a black box ping exporter\n* Old video explainer \u003chttps://www.youtube.com/watch?v=TNg3ga7s_MY\u0026feature=youtu.be\u003e that uses deprecated annotations\n\n# Acknowledgements\n\nshad and SuperQ on the Libera IRC #prometheus channel for helping.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaihendry%2Fslo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaihendry%2Fslo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaihendry%2Fslo/lists"}