Serving health and live quality
Batch monitoring tells you about yesterday’s scores. A model behind an endpoint can fail in ways a nightly job never sees: it answers with errors, it slows down, it cannot scale up, or it answers quickly and wrongly because the callers changed. Pipewright 1.4.3 watches both questions, is the version healthy and is it still right, without a monitoring engine of its own: your YAML becomes Cloud Monitoring alert policies, a sample of live calls lands in your dataset, your own monitor steps run on it, and every finding is an event. All of it is off until you turn it on.
| Question | Setting | Events |
|---|---|---|
| Is the deployed version healthy? | monitoring.health | serving.degraded, serving.recovered |
| Should we go back? | health.propose_rollback_hours | a rollback proposal a person decides |
| What does the endpoint receive? | model.serving.capture | serving.capture_gap, serving.capture_silent |
| Is it still right on live traffic? | monitoring.online | monitoring.alert, monitoring.insufficient_data |
| Which features drive the answers now? | monitoring.online.attribution | monitoring.attribution_drift |
Health: is the deployed version healthy?
monitoring:
health:
enabled: true
error_rate: { warning: 0.01, critical: 0.05 } # share of 5xx answers
latency_p95_ms: { warning: 500, critical: 1000 }
min_ready_replicas: 1
scaling_minutes: 5 # replicas wanted but not ready this long
propose_rollback_hours: 0 # > 0: a critical breach this soon after a deploy proposes a rollback
deploy-model and alerts sync keep one set of alert policies per deployed version, and per A/B arm. Incidents go to the environment’s incident channel (the platform turns it on: serving_health = true in the starter); the launcher turns each into serving.degraded when it opens and serving.recovered when it closes, with the version, the signal, the severity and the threshold in force.
- Agent Platform: errors are 5xx responses over all responses, latency is the 95th percentile of prediction latency, a stuck scale-up is wanted replicas above ready ones.
- KServe: TorchServe’s counters and the reference handler’s latency histogram, through Managed Service for Prometheus.
- Shared pools: errors and latency per model; replicas are reported for the pool.
Rollback proposals, decided by a person
With propose_rollback_hours set, a critical errors or latency incident that soon after a deploy opens a proposal to go back to the version before; so do ready replicas missing in the first hour (a version that does not start). Later, replicas and scale-ups are capacity, not the version, and a first version has nothing to go back to: neither proposes one, though the incident is still sent.
pipewright model rollbacks --env prod --usecase churn
pipewright model rollback --env prod --usecase churn --case <id> --approve # or --decline
Approving makes the previous version the default through the normal approval, its gates checked again, and deploys it.
Capture and online monitoring: is the model still right?
spec:
pipelines:
monitoring: { file: monitoring_pipeline.py, function: churn_monitoring_pipeline }
model:
serving:
capture: { enabled: true, sample_rate: 0.05, max_per_day: 100000, retention_days: 30 }
monitoring:
online: { enabled: true, schedule: "0 6 * * *", window_hours: 24, min_samples: 500 }
Capture records a sample of requests and answers in <usecase>_online_log (on KServe through the team’s capture receiver and a log sink). The monitoring pipeline reads the last window_hours and runs your own drift and performance steps on it, exactly as after batch scoring, against the version that actually serves. Below min_samples the window is insufficient_data and says so: an empty window is never “no drift”. Each hour the launcher compares what capture recorded with what was served, so a capture that stopped is noticed.
For outcomes joined later, callers send a prediction ID and a keyed hash of the unit with each row; the lookup gateway does this for you and returns each prediction ID. Capture on a private endpoint is set when the endpoint is created, so the platform sets capture.sample_rate in its serving file.
Attribution: which features drive the answers now?
monitoring.online.attribution (off by default) measures each feature’s share of the model’s answers on the live window with permutation Shapley values and compares it with training. A move past threshold (total variation distance, 0.10 by default) sends monitoring.attribution_drift with the features that moved most. It needs no labels, so it can warn weeks before outcomes arrive. It does not open a retrain case on its own.
Scale to zero
model.serving.scale_to_zero is your explicit choice. Every call during a scale-up is answered 429 and dropped (2 to 3 minutes measured), and Cloud Monitoring does not count those answers, so validate warns, a platform can refuse it (policies.serving.scale_to_zero: refused; the starter’s serving_policy), and health’s scaling condition catches a scale-up that never finishes.
Who sees what
Every finding is an event on the environment’s topic. The SRE subscription takes the serving events, the ML team’s takes the monitoring ones: pipewright events --persona sre prints the filter. Pipewright Enterprise adds a Health page to Fleet View: each deployed version’s policies, incidents open now and in the last 30 days, hours spent scaling, capture coverage, attribution’s top movers and rollbacks waiting for a decision, from events and policies only, never a request or a feature value.
What it costs (list prices)
| Item | Price | Example |
|---|---|---|
| Agent Platform request logging | no logging charge; BigQuery storage about $0.02 per GiB a month | 100 requests/s at 5%, 4 KiB: about $1 a month |
| KServe capture through the log sink | Cloud Logging $0.50 per GiB after the project’s free 50 GiB | $0 to $25 a month |
| Managed Prometheus (KServe) | $0.06 per million samples | under $0.10 a month per predictor |
| Alert policies | not charged today | 4 to 6 conditions per deployed version |
| Monitoring pipeline | one run plus its steps’ compute | daily: about $1 to $3 a month |
| Attribution | the step’s compute only | 500 rows: about 15 s on 2 vCPU |
Related: Monitoring and retraining, A/B testing, Events.