Skip to main content

Chapter 15. Production Monitoring, Drift, and Evaluator Health

Production Monitoring and Online Evaluation

Offline and release checks cannot anticipate every change in users, policies, tools, and provider behavior. After a policy update, Juniper’s average response time is unchanged, yet eligibility errors rise for a new product category. Because the latency dashboard observes speed rather than policy correctness, it misses the regression. Production monitoring therefore needs signals for outcomes, behavior, tools, data, evaluators, and the measurement pipeline itself.

Monitoring is not a mandate to retain every prompt or run every interaction through a model judge. Choose privacy-aware signals, establish baselines, detect meaningful changes, and get the evidence to someone who can act on it.

After this chapter you will be able to:

  • instrument agent behavior with privacy-aware traces and clear SLOs;
  • choose between streaming and batch monitoring and design sampling;
  • distinguish input, output, behavior, tool, and concept drift;
  • detect change while accounting for noise, multiple slices, and silent updates;
  • monitor evaluator and annotation operations as part of system quality;
  • design tested alerts and incident triage.

Illustrative case. All events and metrics used in the lab are synthetic and are not customer data or production findings.

15.1 Tracing in production and privacy-aware logging

When an error appears, the team needs to know whether the request, model call, tool action, response, and outcome belong to the same interaction. Connect those events with stable identifiers, then record model and tool versions, policy version, timing, status, and resource metadata. Linking the evidence does not require retaining every raw prompt: collect content only when purpose, permission, access, and retention are explicit, and prefer redacted fields, bounded snippets, or secure references to evidence.

Privacy controls must follow the data into logs, caches, embeddings, annotation exports, and backups, with deletion and access behavior tested at each boundary. Synthetic cases can probe both false-positive and false-negative redaction. OpenTelemetry GenAI conventions provide shared trace vocabulary, but they do not decide which sensitive attributes a team should collect [1].

Chapter 14: Production Trace Evaluation develops this into an end-to-end synthetic pipeline, from collection and PII handling through sampling, grading, and decision records.

15.2 Real-time and near-real-time monitoring architecture

Once traces are defined, monitoring can split by how quickly each signal becomes useful. Streaming counters and rules catch immediate operational failures, such as a tool-error spike, latency SLO breach, or surge in authorization denials. Batch jobs suit slower evidence, including human-reviewed quality, slice performance, drift tests, and label agreement. Choose detection latency based on potential harm and when the evidence becomes available.

For each signal, name an owner, baseline, unit, window, minimum volume, threshold, alert destination, and response. A service-level objective should describe a user-relevant property, such as the share of tasks completed safely within a time bound. A model metric without a decision attached is not an operational SLO. The release integrity chapter addresses a related question: even when behavior appears stable, did the deployed system actually use the approved configuration?

15.3 Sampling, online graders, and user feedback

The monitoring system may now have signals and a sampling plan, but the reviewed cases still serve different purposes. A probability sample can estimate population rates; a risk-based sample finds rare severe errors; a disagreement sample helps diagnose a judge. Keep those streams distinct, and retain inclusion probabilities so a stratified sample can be weighted appropriately for population estimates.

Online graders can quickly flag schema violations, missing citations, or tool-state mismatches, while model judges can triage subjective content but need regular calibration against human labels. User feedback adds another signal; respondents may not represent all users, and satisfaction alone does not establish correctness.

15.4 Drift taxonomy and detection methods

If Juniper’s eligibility error rate changes, the alert alone does not say whether requests changed, a tool changed, or the policy itself changed. Distinguish input drift, which changes requests or context; output drift, which changes response properties; behavior drift, which changes actions or trajectories; tool drift, which changes schemas, errors, or state behavior; and concept drift, which changes how inputs relate to desired outcomes, often after a policy or product change. A shift in embeddings or token distributions is a clue to investigate, not proof of worse quality.

Useful first detectors include bounded feature rates, two-sample tests, distribution distances, and change-point methods. Specify a reference window, current window, minimum sample, and practical effect size. Because repeatedly checking many signals creates false alerts, account for multiple looks or require a calibrated persistence rule before paging. Review examples before automatically changing a dataset or model.

15.5 Distribution shift and dataset refresh

Once the type of drift is clearer, ask whether the evaluation set still resembles the traffic the service handles. Compare production and evaluation cases on intent, language, tool route, risk, modality, and missing-data patterns. A mismatch suggests the set may no longer cover current traffic, so refresh it through a governed process: identify the shift, sample cases, label the evidence, version the update, and preserve a sealed holdout.

Do not silently replace the evaluation population. Report both the stable reference set and the refreshed representative set so reviewers can distinguish a system regression from a population shift. A flywheel that adds cases without quality review can bring in noise and bias.

15.6 Separating degradation from noise

Even with comparable populations, observed rates fluctuate. Set stable baselines, minimum sample requirements, and intervals or control limits, then compare the same task slices under the same policy and evaluator versions. A provider update can look like a model regression; record identifiers and keep canary tasks that probe stable behavior.

Testing many slices repeatedly will produce false alerts. Name primary indicators, apply correction or persistence rules to secondary signals, and require practical as well as statistical significance. An alert points to a change; it does not identify the cause.

15.6.1 Sequential monitoring: CUSUM and Page-Hinkley

For a stream of metric values \(x_1,x_2,\dots\)—for example, an hourly error rate or judge-disagreement rate—sequential detectors accumulate evidence and signal when a persistent shift is plausible. They complement, rather than replace, the operational thresholds and case review above.

CUSUM (Cumulative Sum). Let \(\mu_0\) be the in-control mean and \(k>0\) a reference value (typically half the minimum detectable shift). Define:

\[S_t^+=\max(0,\; S_{t-1}^+ + (x_t - \mu_0 - k)),\qquad S_t^-=\max(0,\; S_{t-1}^- - (x_t - \mu_0 + k)),\]

with \(S_0^+=S_0^-=0\). Signal an upward shift when \(S_t^+ > h\) or a downward shift when \(S_t^- > h\), where \(h\) is the decision interval chosen to control the average run length to false alarm.

Page-Hinkley. For detecting a change in mean, let \(\bar{x}_t\) be the running mean and let \(\delta\ge0\) be a tolerance for small, unimportant deviations:

\[\bar{x}_t=\frac1t\sum_{i=1}^t x_i,\qquad U_t=\sum_{i=1}^t(x_i-\bar{x}_i-\delta),\]

\[PH_t=U_t-\min_{0\le s\le t}U_s,\qquad U_0=0.\]

Signal drift when \(PH_t>\lambda\). The tolerance \(\delta\) and threshold \(\lambda\) trade sensitivity and detection delay against false alarms.

Both detectors assume observations are approximately independent. For autocorrelated metric streams, thin the stream, set thresholds with a block bootstrap, or model the autocorrelation directly.

15.6.2 Control charts

Control charts separate common-cause variation from special-cause shifts.

Shewhart chart. For a chart of subgroup means, let \(\mu_0\) and \(\sigma_0\) be the in-control mean and standard deviation of individual observations, and let \(n\) be the number of observations in each subgroup. Plot each subgroup mean \(\bar x_t\) against:

\[\text{UCL}=\mu_0+3\frac{\sigma_0}{\sqrt{n}},\qquad \text{LCL}=\mu_0-3\frac{\sigma_0}{\sqrt{n}},\]

Under independent normal observations, a point outside the limits signals a special cause, with a false-alarm probability of roughly 0.27% per point when the process is in control. This is the simple \(\bar X\)-chart case; rates, counts, small samples, and autocorrelated observations may require a different chart and calibrated limits.

EWMA (Exponentially Weighted Moving Average). Apply it to subgroup means \(x_t=\bar{x}_t\) and initialize \(z_0=\mu_0\). Because it gives past observations declining weight, EWMA can reveal smaller persistent shifts than a point-by-point chart:

\[z_t=\lambda x_t+(1-\lambda)z_{t-1},\qquad 0<\lambda\le1,\]

with two-sided control limits:

\[\text{UCL}=\mu_0+L\frac{\sigma_0}{\sqrt{n}}\sqrt{\frac{\lambda}{2-\lambda}\left[1-(1-\lambda)^{2t}\right]},\qquad \text{LCL}=\mu_0-L\frac{\sigma_0}{\sqrt{n}}\sqrt{\frac{\lambda}{2-\lambda}\left[1-(1-\lambda)^{2t}\right]}.\]

Here, \(n\) is the subgroup size and \(L\) sets the width of the limits. Smaller \(\lambda\) gives older observations more influence and responds more slowly; larger \(\lambda\) reacts faster but passes through more short-term noise. Choose parameters and limits against the smallest shift that matters in practice.

15.6.3 Multiple comparison control in monitoring

If \(m\) independent slices or metrics are each tested at level \(\alpha\), the family-wise probability of at least one false alert is:

\[P(\text{at least one false alert})=1-(1-\alpha)^m.\]

Bonferroni: Set each test’s level to \(\alpha/m\). This is simple and can be conservative when metrics are correlated.

Benjamini–Hochberg FDR: Sort the \(p\)-values, \(p_{(1)}\le\cdots\le p_{(m)}\). Find the largest \(k\) for which \(p_{(k)}\le \frac{k}{m}q\), then reject the first \(k\) nulls. Under independence or suitable positive dependence, this controls the false discovery rate at level \(q\) and can be more powerful than Bonferroni. State the dependence assumptions and avoid applying it mechanically to repeated, unplanned looks at the same stream.

Persistence rule: Alert only after a signal lasts for \(w\) consecutive windows. This cuts false alarms but delays detection, a reasonable trade when a false page is more costly than a short delay.

15.6.4 Sample size and detection power

To detect a shift from baseline rate \(p_0\) to \(p_1=p_0+\Delta\) with power \(1-\beta\) at level \(\alpha\) using independent Bernoulli observations:

\[N \approx \left(\frac{z_{1-\alpha/2}\sqrt{2\bar p(1-\bar p)} + z_{1-\beta}\sqrt{p_0(1-p_0)+p_1(1-p_1)}}{\Delta}\right)^2,\qquad \bar p=\frac{p_0+p_1}{2}.\]

For rare events (\(p<0.01\)), use exact binomial methods or Poisson approximations; normal approximations may understate the needed volume. Report the minimum detectable effect at your actual traffic volume, not just the observed rate.

15.7 Monitoring evaluators and annotation operations

The monitoring pipeline also depends on people and evaluators who may fall behind or change behavior. Track judge-human agreement, slice-level confusion, score distributions, abstentions, and performance on a gold set. Because a judge may drift after a prompt, model, rubric, or task-distribution change, recalibrate against a versioned gold set and keep prior calibration mappings to interpret historical scores.

Keep two review streams: a probability-based sample of eligible production cases to estimate performance, and a targeted sample of disagreements, high-risk cases, and suspected failures to diagnose them. Adjudicate the reference labels independently of the judge. Re-grade a fixed set of cases when the judge, prompt, rubric, parser, or evidence pipeline changes; also check production samples for new failure modes and calibration by important slice. Agreement with the incumbent judge is not ground truth.

Predefine the operational response to degraded judge performance. If a judge misses its qualification or monitoring gate, stop using its score as an automatic release or user-impacting decision signal; route affected cases to an authoritative deterministic check or qualified human review, or mark the result insufficient evidence. Preserve the judge version and traces, investigate disagreements, and resume automated use only after requalification. Do not trigger an agent rollback solely because a judge score shifted until the team has checked for judge drift and verified user or system outcomes.

For annotation operations, track backlog, assignment and drop-off rates, time to label, adjudication volume, reviewer disagreement, and vendor SLA attainment. A slow or biased queue can make online quality look stable simply because new failures have not been reviewed. Treat measurement-pipeline outages as incidents.

Apply Chapter 16’s evaluation-system SLOs as operational gates. If required traces, evaluator outputs, priority reviews, or critical alerts miss their objective, mark the affected period or release as insufficient evidence. A quiet dashboard does not show a healthy agent when the measurement pipeline is incomplete.

15.8 Shadow mode and guardrail telemetry

Shadow evaluation compares candidate behavior without letting it control the live interaction; the shadow and canary chapter develops that rollout method. Guardrail telemetry adds a different question: what did the running system attempt, and which actions did policy prevent? Compare candidate outputs and planned actions under privacy-aware controls; a disagreement is a reason to review, not a label by itself.

Track policy denials, approval requests, blocked unsafe actions, escalations, and override outcomes. Check that the monitoring system does not expose sensitive data to staff who should not see it.

15.9 Alert design, fatigue, and testing monitors

Guardrail signals help only if the right person receives an actionable alert. Include the symptom, affected population, evidence link, severity, owner, and immediate action. Page when timely intervention is needed; route lower-urgency signals to a dashboard or review queue. Track alert precision, acknowledgement time, and recurrence.

Test monitors with known synthetic shifts and quiet controls, then follow the alert end to end to check delivery, deduplication, escalation, and recovery. A running detector with a misrouted notification is not healthy.

15.10 Incident response and root-cause triage

When an alert escalates into an incident, the first dashboard signal is only the starting point. Preserve relevant versions and traces, contain unsafe actions, assess user impact, and label observations separately from hypotheses. Check the model, prompt, tools, policy, environment, dataset, judge, and monitors. Prepare a rollback or safe fallback, then define what must be true before service resumes.

Once the incident is resolved, turn it into a regression case only when the failure is understood and a trustworthy oracle exists. Record the incident, decision, owners, and remaining uncertainty so later reviewers can understand the resulting test. Chapter 17 covers structured failure analysis.

15.11 Human feedback as an evaluation signal

Incident review may surface ratings, corrections, repeat contacts, escalations, overrides, and task completion confirmed by a person. These human signals are useful, but they do not mean the same thing or have the same reliability. A thumbs-up may reward speed or tone rather than correctness; an override may expose a policy conflict, a missing capability, or an operator preference. Record each event with its context instead of collapsing them into one label.

Feedback is often missing not at random: people who respond, abandon, or escalate may differ from those who do not. To estimate population quality, maintain a probability-based review sample alongside targeted feedback review. Capture enough context to interpret each label—task and policy version, action or state evidence, whether the reviewer saw the full interaction, and the rubric—while minimizing personal data.

Use feedback first to prioritize review and find possible failure categories. Before treating it as a label, verify the event, adjudicate ambiguity, and separate preference from correctness or safety. Before using it for training or reward optimization, document consent and permitted purpose, check subgroup and incentive effects, protect held-out evaluation data, and track which feedback influenced each release. More feedback is not automatically better evidence.

Chapter summary

  • Trace the full interaction while minimizing retained sensitive content.
  • Match stream or batch detection latency to risk and actionability.
  • Distinguish drift signals from proven quality degradation.
  • Keep reference and refreshed evaluation populations versioned and comparable.
  • Recalibrate judges and monitor annotation throughput and quality.
  • Make alerts actionable and test the monitor pipeline itself.
  • Preserve evidence and separate symptoms from causes during incidents.
  • Treat user feedback as a biased review signal until its meaning and provenance are validated.

For product managers. Which failure needs an immediate alert, and who responds? Ask what monitoring retains, how its sample supports a population estimate, and how the team checks judge and reviewer calibration.

Hands-on lab: Production monitoring

Run python code\ch23\lab_monitoring.py. This teaching example compares a Bernoulli rate with a fixed baseline after a minimum sample size. It is not a production drift detector.

from bookkit.system_eval import rate_alert

print(rate_alert(baseline_rate=0.05, current_events=12, current_total=100,
                 min_total=50, alert_rate=0.10))
{'alert': True, 'current_rate': 0.12, 'reason': 'rate_threshold'}

Exercises

  1. Design. Define a monitoring plan for eligibility errors after a policy update.
  2. Hands-on. Reduce current_total below min_total and verify the lab reports insufficient volume rather than a rate alert.
  3. Sampling. Design separate random and risk-based review samples and explain which estimates each supports.
  4. Operations. Write alert content and a synthetic test that verifies end-to-end notification.
  5. Feedback. Separate explicit ratings, corrections, overrides, and repeat contacts; explain which can support a quality estimate and how you would validate them.

Further reading

  • OpenTelemetry GenAI semantic conventions, for trace attributes and spans [1].
  • NIST AI RMF, for measuring and managing system risk over its lifecycle [2].
  • Artstein and Poesio, for agreement measurement in human annotation [3].
  • Miller, for uncertainty framing in evaluation metrics [4].
[1]
OpenTelemetry Authors, “OpenTelemetry semantic conventions for generative AI.” Accessed: Nov. 10, 2026. [Online]. Available: https://github.com/open-telemetry/semantic-conventions-genai
[2]
National Institute of Standards and Technology, “Artificial Intelligence Risk Management Framework (AI RMF 1.0),” National Institute of Standards; Technology, NIST AI 100-1, 2023. doi: 10.6028/NIST.AI.100-1.
[3]
R. Artstein and M. Poesio, “Inter-coder agreement for computational linguistics,” Computational Linguistics, vol. 34, no. 4, pp. 555–596, 2008, doi: 10.1162/coli.07-034-R2.
[4]
E. Miller, “Adding error bars to evals: A statistical approach to language model evaluations.” 2024. Available: https://arxiv.org/abs/2411.00640