This episode brings observability to large scale: monitoring high-cardinality Envoy metrics, trace sampling and log aggregation strategies, and designing SLOs and SLIs for the proxy layer and service quality.

In episode 11 you connected Envoy to Prometheus, tracing, and access logs. Episode 21 answers the question that comes up as scale grows: how do you monitor thousands of Envoys without blowing up your observability storage, and how do you turn that data into a measurable promise — an SLO (Service Level Objective).
You'll learn to handle high-cardinality metrics, choose sampling strategies for tracing, aggregate logs without losing context, and design SLI/SLOs for the proxy layer that genuinely reflect user experience.
Envoy's per-listener and per-cluster metrics are already many, but cardinality explodes when dynamic labels enter — for example per-request header values, many virtual hosts, or custom tags from stats_tags. Every new label combination means a new time series in Prometheus.
stats_config:
stats_tags:
- tag_name: cluster
regex: "^cluster\\.(.+?)\\.(upstream|membership)\\."
- tag_name: virtual_host
regex: "^vhost\\.(.+?)\\."The stats_tags rules determine which labels are extracted. The more tags you define, the higher the cardinality. Choose tags actually used in queries and dashboards — leave the rest as part of the metric name.
Some habits that keep Prometheus healthy:
histogram_buckets, not overly fine ones.curl -s localhost:9901/stats/prometheus | grep -c "^envoy"The ^envoy grep counts the number of metric series one Envoy exports. Multiply by the number of instances to estimate Prometheus load. If the number starts getting out of hand, reevaluate the tags you defined.
For metrics that are very large, sampling may be necessary. The concept: don't scrape every instance every interval; scrape a subset or reduce the interval. The trade-off between granularity and cost must be decided deliberately.
Recording 100 percent of traces at large scale isn't realistic. Common sampling strategies:
tracing:
http:
name: envoy.tracers.opentelemetry
typed_config:
"@type": type.googleapis.com/envoy.tracers.opentelemetry.v3.OpenTelemetryConfig
grpc_service:
envoy_grpc:
cluster_name: otel_collector
service_name: envoy-gateway
sampling_config:
default_sampling_percentage: 10The value default_sampling_percentage: 10 makes Envoy sample only 10 percent of requests for tracing. Start with a low percentage, then raise it only when investigation needs are truly high.
Envoy access logs can be enormous. The keys to efficient aggregation:
format: "%START_TIME% %DOWNSTREAM_REMOTE_ADDRESS% %REQ(X-REQUEST-ID)% %REQ(TRACEPARENT)% %RESPONSE_CODE% %RESPONSE_FLAGS% %DURATION%ms %UPSTREAM_CLUSTER% %UPSTREAM_HOST% %REQ(METHOD)% %REQ(PATH)%\n"The %RESPONSE_FLAGS% and trace ID format above gives all the debugging information without burdening the agent with complex parsing. Structured logs are worth more than long logs.
An SLI is a concrete measurement of service quality. For the proxy layer, common SLIs:
An SLO is a target chosen from an SLI, for example "p99 latency below 200ms 99.9 percent of the time". Make SLOs realistic — too strict and the team gets paged constantly; too loose and users aren't protected.
curl -s localhost:9901/stats/prometheus | grep "upstream_rq_time" | head -3
curl -s localhost:9901/stats/prometheus | grep "upstream_rq_5xx"To calculate the error budget periodically, query Prometheus aggregates:
sum(rate(envoy_cluster_upstream_rq_5xx[5m])) by (envoy_cluster_name)
/ sum(rate(envoy_cluster_upstream_rq_total[5m])) by (envoy_cluster_name)The PromQL query envoy_cluster_upstream_rq_5xx computes the proportion of 5xx errors per cluster over 5 minutes. The error budget is calculated by comparing the actual SLI against the SLO target over the running period.
In a mesh ecosystem, SLOs also cover services as a whole, but the proxy layer has a special role: mTLS, retries, and routing affect availability from the infrastructure side. Monitor proxy SLIs separately from application SLIs so you can distinguish "proxy problem" from "application problem".
An error budget isn't just a number — it's a decision tool:
A good SLO turns "feeling safe" decisions into data-driven ones. For the proxy layer, this means combining Envoy metrics with the release process built in episode 20.
curl -s localhost:9901/stats/prometheus | grep "envoy_cluster_upstream_rq_5xx"Monitor envoy_cluster_upstream_rq_5xx periodically. A spike approaching the budget limit is a signal to hold changes until the trend drops.
Episode 21 closed out the observability pillar: managing metric cardinality, sampling and aggregation strategies, and designing SLO/SLIs that turn Envoy data into operational decisions.
Key takeaways:
stats_tags.In the next episode, episode 22, we'll discuss production hardening and best practices — a security hardening checklist, an operational checklist with runbooks and debugging tools, and Envoy upgrade considerations with fallback strategies.