In this lesson, you will learn how to bridge the gap between low-level infrastructure telemetry and the actual experience of your end users by selecting meaningful Service Level Indicators (SLIs).
While your Kubernetes clusters might report high CPU usage or pod restarts, those metrics are "system-centric." To define an SLI for User Experience (UX), you must pivot to "user-centric" measurement: focusing on what the user perceives when they interact with your application via the load balancer or ingress controller.
The "Golden Signals" for UX
For web-based services, your SLIs should focus on three primary categories:
- Availability: Is the service usable? Instead of tracking
kube_pod_status_ready, track the ratio of successful HTTP 2xx/3xx responses to total requests at your Ingress point. - Latency: How long does it take for a user request to complete? Focus on the time taken for the server to process a request, excluding network transit time. Crucially, use percentiles (e.g., P95 or P99) rather than averages to capture the experience of users suffering from outliers.
- Quality: Is the response actually correct? An error-free, low-latency 404 page is not a "healthy" service. Track successful business transactions (e.g., successful "Add to Cart" requests) versus total attempts.
Implementation Example
When using an ingress controller like NGINX, you can leverage Prometheus metrics to capture these SLIs directly from the edge:
# SLI: Latency (P99) for checkout requests
histogram_quantile(0.99, sum(rate(nginx_ingress_controller_request_duration_seconds_bucket{path="/checkout"}[5m])) by (le))
# SLI: Availability (Success Rate)
sum(rate(nginx_ingress_controller_requests{status!~"5.."}[5m])) / sum(rate(nginx_ingress_controller_requests[5m]))
Avoid the trap of monitoring every individual microservice. Instead, focus on the "request path" from the user’s perspective. If a request passes through five microservices but the user experiences a 200ms delay, the SLI should be tied to the entry-point latency. If you only track the latency of the backend database, you lose visibility into the cumulative overhead introduced by your CI/CD service mesh or network hops.
Key Takeaway: A Service Level Indicator is only valid if it accurately reflects the user’s journey; prioritize metrics measured at the network edge over internal infrastructure telemetry.