How would you monitor SLOs for a gRPC service?
BeginnerScenarioSLOs and Error Budgets
Answer
Situation read → gRPC returns status codes in trailers, often with HTTP 200 at the transport level.
What I'd do →
- Use gRPC interceptors (e.g.
grpc_server_handled_totalfrom go-grpc-prometheus or OTelrpc.server.duration). - Count error codes that indicate server failure:
UNAVAILABLE,INTERNAL,DEADLINE_EXCEEDED,UNKNOWN,DATA_LOSS. - Exclude client errors such as
INVALID_ARGUMENT,NOT_FOUND.
sum(rate(grpc_server_handled_total{grpc_service="orders.Orders",grpc_code=~"Unavailable|Internal|DeadlineExceeded|Unknown"}[5m]))
/ sum(rate(grpc_server_handled_total{grpc_service="orders.Orders"}[5m]))
Why → HTTP status codes alone miss gRPC failures.
Interview tip → Mention that gRPC errors often hide behind HTTP 200.
More on SLOs and Error Budgets
Your company has no SLOs. A VP asks you to introduce them. Where do you begin?BeginnerChoose an SLI for a REST API: availability measured at the pod, the load balancer, or the client?IntermediateThe product owner wants a 99.99% SLO for a service that depends on a database with 99.95% availability. What do you say?IntermediateThe error budget for the month is exhausted on day 18. What happens now?IntermediateWrite an SLO in a declarative tool so teams do not hand-write burn-rate rules.AdvancedLatency SLO: "99% of requests under 300 ms." How do you measure it correctly in Prometheus?Intermediate