Concepts / Monitoring Production AI Systems

Monitoring Production AI Systems

Observability is the practice of instrumenting a system so that its internal state can be inferred from its logs and metrics, and it matters more as products grow more complex.

  • Programming

A Quiet Failure on a Tuesday

Imagine an application built from many interacting components, including language models, retrieval steps, tool calls, and a web front end. A change goes out on a Tuesday afternoon. Nothing crashes, no alarm fires, and the team goes home. Two days later a customer reports that answers have quietly become wrong for a subset of questions.

The central question of this article is not only how the failure happened, but how long it went unseen and how long it took the team to repair it once they knew. Those two durations are what the course's metrics are built to measure, and the rest of the article shows how to read them.

What do you think happens?

Given the Tuesday scenario, would the team have known about the wrong answers on Tuesday evening?

  • Yes, the team would have seen it within hours

  • No, the team would not have known until the customer reported it

  • Only if the system crashed

Reveal answer
Answer:

No, the team would not have known until the customer reported it.

Nothing crashed and no alarm fired, so no signal reached the team. The failure was already real but unseen until the customer's report arrived two days later.

Why Complexity Raises the Stakes

The source argues that visibility into a system should be designed in from the start rather than bolted on afterward. The reasoning is that the more complex a product is, the more costly it becomes to be blind to what it is doing. A single component can often be understood by reading its behavior directly. Once many components interact, a wrong answer at the front end may originate several steps away, in a retrieval step or a tool call, and nothing about the final output points to where.

This is why observability matters more as architecture grows. Each added component and each added dependency between components increases the number of places a fault can hide, while the outputs the user sees stay the same shape. The practical job of observability is to make sure the system exposes enough information that its internal state can still be understood from what it produces.

Where the Failure Hides in Time

To make the metrics concrete, attach them to a single failure as it unfolds. The sequence has four moments in order. First, a change is deployed. Some time later the failure actually begins, meaning the system starts behaving incorrectly. At some later point, someone or something notices the problem. Finally, the problem is resolved and the system behaves correctly again.

Change deployedFailure beginsFailure detectedFailure resolvedMTTD gapMTTR gap
Which intervals between the start of the failure, its detection, and its resolution do MTTD and MTTR measure?

The first gap runs from the moment the failure begins to the moment it is detected. The source's metric MTTD, mean time to detect, is the average of this gap across many incidents. The second gap runs from detection to resolution, and the metric MTTR, mean time to resolve, is the average of that gap. Together they split the failure's lifetime into two consecutive intervals. The gap between deployment and the start of the failure is not one of the two measured intervals.

The two gaps carry different meanings. The failure was already real before anyone knew about it, so a long detection gap means the system spent that period producing wrong output with nobody acting on it. A long resolution gap means the team knew about the problem but the repair took time. A system can have a fast detection gap and a slow resolution gap, or the reverse, and the two numbers point to different weaknesses.

Monitoring Versus Observability

Monitoring and observability are easy to blur together, but they describe different things. Monitoring is the act of tracking a system's information. Observability is the larger process that contains monitoring along with instrumenting the system and debugging it. In the source's convention, observability covers the whole cycle of instrumenting, tracking, and debugging, not just the act of watching.

Tracks externaloutputsInstrumentingNo assumed link tointernal stateTrackingDebuggingInfers internal statefrom outputs
What can monitoring see directly from outside the system, and what must observability reconstruct about the internal state from those outputs?

The sharpest difference lies in what each approach assumes about the link between a system's outputs and its internal state. Traditional monitoring makes no such assumption. You watch external outputs in order to notice that something has gone wrong inside, but nothing guarantees that those outputs will reveal what the internal fault actually is. Observability asks more of the system. It assumes that internal state can be reasoned about from outputs, so a well-instrumented system should let you pinpoint a cause from its logs and metrics alone.

Monitoring still has real value on its own. The source gives its purpose as helping to mitigate risks and to discover opportunities. The risks named include application failures, security attacks, and drifts in behavior. Monitoring can also surface opportunities for improving the application and saving cost, and it keeps the people responsible for a system accountable by making its performance visible.

How Production Signals Loop Back

Monitoring is not meant to operate alone. The source describes evaluation and monitoring as working closely together. Metrics used during evaluation should translate well into metrics used during monitoring, so that a model which performs well in testing also performs well in production. The loop runs the other way as well: issues that monitoring detects in production should be fed back into the evaluation pipeline, so that the next round of testing can catch them before deployment.

Production signalsMonitoring detectsissueEvaluation pipelineNext test roundDeploymentwatchedfed backnew check addedcaught before release
How do production signals flow back through the evaluation pipeline, and what changes in the system after each loop?

Each pass through this loop leaves the system in a different state than before. The issue that monitoring surfaced now belongs to the set of cases the evaluation pipeline checks, so the next round of testing has a chance to catch a repeat before it reaches users. The loop is what turns a production incident into a test that protects future releases.

Calculating MTTD, MTTR, and CFR

The source names three metrics drawn from the DevOps community. The first two measure the gaps in the timeline. The third measures how often changes cause problems in the first place. Each is an average or a percentage over many events, so a single incident says very little on its own. For a set of n incidents, let d_{i} be the detection gap of incident i and r_{i} its resolution gap. Then:

Rule

CFR, the change failure rate, is the percentage of changes that need fixes or rollbacks. Over a set of deployments it is the number of changes that needed a fix or rollback divided by the total number of changes, expressed as a percentage.

Rule

Worked example

Three incidents and twelve deployments

A team logged three incidents this quarter. Incident A: failure began at 10:00, was detected at 10:30, and was resolved at 11:30. Incident B: failure began at 14:00, was detected at 16:00, and was resolved at 16:20. Incident C: failure began at 09:00, was detected at 09:10, and was resolved at 12:10. Over the same quarter the team made 12 deployments, and 3 of them needed a fix or a rollback. Find MTTD, MTTR, and CFR.

  1. 1
    Detection gaps

    A: 10:30 minus 10:00 is 30 minutes. B: 16:00 minus 14:00 is 120 minutes. C: 09:10 minus 09:00 is 10 minutes.

  2. 2
    Resolution gaps

    A: 11:30 minus 10:30 is 60 minutes. B: 16:20 minus 16:00 is 20 minutes. C: 12:10 minus 09:10 is 180 minutes.

  3. 3
    MTTD

    The sum of detection gaps is 30 + 120 + 10 = 160 minutes. Dividing by 3 incidents gives about 53.3 minutes.

  4. 4
    MTTR

    The sum of resolution gaps is 60 + 20 + 180 = 260 minutes. Dividing by 3 incidents gives about 86.7 minutes.

  5. 5
    CFR

    3 changes needed a fix or rollback out of 12 total, so CFR is 3 divided by 12, which is 25 percent.

Result

MTTD is about 53.3 minutes, MTTR is about 86.7 minutes, and CFR is 25 percent. Incident C dominates the repair average, so the average hides that most repairs were quick. The 25 percent CFR points toward the evaluation pipeline as much as toward monitoring.

Read together, the three numbers give a fuller picture than any one of them. MTTD and MTTR describe how quickly a system's problems become visible and how quickly they are repaired. CFR describes how often changes cause those problems at all. A team that watches only one of these numbers can be misled about where its weakness really lies.

Mistakes When Reading the Metrics

  • Common mistake

    Treating MTTD as the time it takes to fix a problem

    What it looks like

    Reading a detection average of 53 minutes as proof that repairs take 53 minutes.

    Why it fails

    MTTD covers only the gap from the start of the failure to its detection. Repair time is the separate MTTR interval, measured from detection to resolution.

    Do this instead

    Read MTTD as detection speed and MTTR as repair speed, and check each against its own gap.

  • Common mistake

    Measuring the gap from deployment instead of from the start of the failure

    What it looks like

    Counting the time from a Tuesday deploy to the customer report as detection time.

    Why it fails

    The failure may begin some time after the deployment, so deployment time mixes an unmeasured interval into the detection gap.

    Do this instead

    Start the detection gap at the moment the system began behaving incorrectly.

  • Common mistake

    Judging a team by a single incident

    What it looks like

    Concluding that monitoring is broken because one incident took 180 minutes to resolve.

    Why it fails

    Each metric is an average or a percentage over many events, so one incident tells very little on its own.

    Do this instead

    Compute the metric over a set of incidents or deployments before drawing a conclusion.

  • Common mistake

    Assuming monitoring alone shows the internal cause

    What it looks like

    Seeing wrong answers in the output and assuming the monitor identifies which component failed.

    Why it fails

    Monitoring tracks external outputs and makes no assumption that they reveal the internal fault. Observability is the broader practice that depends on instrumentation.

    Do this instead

    Instrument the system so its logs and metrics capture the information needed to infer internal state.

Practice: Reading an Incident Log

MEDIUM

A team reports the following for one quarter: four incidents with detection gaps of 15, 45, 30, and 60 minutes, and resolution gaps of 30, 90, 60, and 30 minutes. Over the same quarter 20 changes were deployed, and 5 needed a fix or rollback. Compute MTTD, MTTR, and CFR, then state which of the two intervals points to the weaker part of the system and whether the CFR suggests looking at the evaluation pipeline.

Hints
  • Add the four detection gaps and divide by 4 to get MTTD.
  • Add the four resolution gaps and divide by 4 to get MTTR.
  • CFR is 5 divided by 20, expressed as a percentage.

Key Takeaways

  • Observability matters more as architecture grows because each added component and dependency makes internal state harder to infer from outputs alone.
  • Monitoring tracks external outputs and makes no assumption about their link to internal state, while observability covers instrumenting, tracking, and debugging, and assumes internal state can be reasoned about from outputs.
  • MTTD measures the average gap from failure start to detection, MTTR measures the average gap from detection to resolution, and together they split a failure's lifetime into two consecutive intervals.
  • CFR is the percentage of changes needing a fix or rollback; a high CFR points toward the evaluation pipeline as much as toward monitoring.
  • Issues detected in production should be fed back into the evaluation pipeline so the next round of testing can catch them before deployment.

Related concepts

More concepts starting with M