Collect metrics from every inference cluster #470
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #470"
general
weight: 0.35
lsviben
Description of your changes
#363 described how a fleet's metrics get off its clusters and onto one surface. Nothing implemented it, so a platform engineer had no way to read an engine, a gateway or a GPU across clusters, and the names they would read differed per engine anyway.
This composes an OpenTelemetry collector onto every
InferenceClusterand gives it two kinds to read. AMetricMappingsays what a component emits and what Modelplane calls it:from,to,fromUnitwhere the source is measured in something other than the target name claims, andlabelsandpartfor the series that need several of a component's metrics to become one of Modelplane's. ATelemetryDestinationsays where it goes:name,type,endpoint,secretRefandauthare fields, and everything else an exporter takes passes through unread, because that schema is OpenTelemetry's and moves on its own schedule. Several can exist and their sinks are concatenated, so a second backend is a new object rather than an edit to one somebody else owns, and the credential named by asecretRefis copied from the control plane to each cluster that mounts it.The function compiles a mapping to OTTL rather than an operator writing it, which keeps the collector's configuration language out of a Modelplane API and leaves room to render something else later. Five built-in mappings carry 32 metrics off vLLM, SGLang, the gateway, the picker and DCGM. Only
modelplane_leaves a cluster. The collector does not count towards aServingStack's readiness: nothing serving depends on it, and a destination pointing somewhere unreachable should not stop the scheduler placing replicas.Each replica publishes its own series, told apart by a
replicalabel, and a query over a deployment combines them -sum by (deployment)for anything counted,avgfor a ratio. The collector does not combine them, because a scrape of one replica is one batch and adding two cumulative readings taken at different moments is not the traffic that happened. The label is the replica's index rather than its pod, so it is bounded by the replica count and survives a restart and a rolling update.That is 23 of the 50 metrics #363 describes, which is everything reachable by renaming one metric to one name. #476 lists the rest; most of it needs per-object state from resource-state-metrics rather than anything here.
The endpoint picker, the credential path and multiple destinations are verified on that cluster too:
modelplane_route_decision_secondsarrives labelledrole=pickeronce the gateway routes a request, a sink'ssecretRefSecret written only on the control plane turns up inmodelplane-systemon the GPU cluster with the collector mounting it, and twoTelemetryDestinations render one config carrying both sinks.It also fixes cross-cluster routing on GKE, because the gateway metrics depend on it. A cluster gateway's name was published as a headless Service and an EndpointSlice, and kube-dns builds its records from the Endpoints API and was never taught the slice one. GKE runs kube-dns, so the name answered NXDOMAIN, Envoy resolved no address for the backend, and every cross-cluster request was refused with no healthy upstream. kind runs CoreDNS, which reads the slice, which is why CI has never seen it. #486 has the detail.
Verification
Run on a GKE cluster with two L4s, vLLM serving Qwen2.5-0.5B, two replicas, loaded to saturation, and later alongside SGLang on the second GPU. Everything here is
modelplane_arriving through the composed collector.!Modelplane telemetry in Grafana
Each layer caught what the one before it couldn't. The collector's own
validatecaught a value rewrite rendered into a context that cannot reach values. The local two-cluster e2e, which--verifynow gates on, caught an engine scrape job matching a label value that never existed, an unnamed engine port, a gateway job asking Envoy for a path it 404s on, a substrate job ignoringprometheus.io/portbeside the annotation it honoured, and every series labelled with a generated name rather than the cluster's. Real GPU hardware caught everymodelplane_gpu_*series arriving empty, because nothing annotates DCGM for scraping and GKE runs its own. A second replica caught two replicas colliding into one series: the engines held 300 and 4640 prefix-cache lookups and the series read 300. Reading a Grafana dashboard caught Prometheus receiving every series stripped of its identity, since that identity is resource attributes and the remote-write exporter drops those unless asked. Running the collector against a rendered config caughtscale_metricrefusing an integer factor, which would have stopped it starting on any fleet converting mebibytes; feeding it a histogram in milliseconds confirmed the sum, the bounds and the bucket counts all come out converted, which the previous datapoint rewrite never reached.Running a second engine found more. SGLang v0.4.9.post2 on the same cluster publishes three of the eight metrics its built-in named and no others:
sglang:queue_time_secondsand both retraction counters don't exist at that version, or at v0.4.6 or v0.5.0, so those mappings could never match. Its two token histograms are real but need--collect-tokens-histogrambeside--enable-metrics, which the guide didn't say. And aMetricMappingstored before a field became required took the whole ServingStack toReconcileError: a CRD validates on write, not on what it already holds, so the stale object parses straight into aValidationErrorand fails the pipeline step. A telemetry object now gets dropped with a warning rather than stopping the fleet placing replicas.labelsandparthave no built-in using them, but both are exercised on a cluster. A mapping folding SGLang's prompt and generation counters onto one name givesmodelplane_tokens_total{direction="input"}398 and{direction="output"}607;part: Countover its latency histogram givesmodelplane_engine_requests_total12, matching the requests sent; and avaluesremap turnsengine_type="unified"intoengine_kind="Unified"and drops the original. They are what the counters in #363 need - tokens by direction, responses by reason, requests by status.One thing I have not done: the gateway's time-to-first-token and time-per-output-token exist only for streaming requests, and I have not driven one.
I have: <!-- You MUST either [x] check or [ ] ~strike through~ every item. -->
nix flake check(or./nix.sh flake check) and made sure it passes.git commit -s.