Nguyen Le Phong

Observability Is a Design Decision

Whether production can explain itself depends on choices made before release: event names, one trace ID through every hop, and alerts that point at user pain.

Three customers are stuck at checkout and support wants to know why. You open the dashboards. Error rate is up a hair, nowhere near enough to explain it. The logs have plenty of lines, but no two services share a request ID. Payments says it's healthy. Orders says it's healthy too. Every screen is telling a small piece of the truth, and none of the pieces connect.

Two engineers in a meeting room: one sketches a request flow on a glass wall with a marker while the other watches, next to a wall screen showing a service map and latency charts.
The goal is one story per customer request, which you can follow from the service map down to the line that failed.

That's the moment observability stops being an ops topic and becomes a design topic. It's tempting to treat logs, metrics, traces, dashboards and alerts as things you bolt on after the feature works. Production doesn't wait for that. The questions it asks depend on decisions you made months ago: what you named things, which IDs you passed along, and what you chose to measure. This post is about making those decisions on purpose, before release. For the scaling side (sampling, SLOs, burn-rate alerts), see Observability at Scale.

A design question, asked before release

The OpenTelemetry docs define observability as being able to understand a system from the outside, asking it questions without knowing its inner workings. They also give a handy bar for "done": an application is properly instrumented when developers don't need to add more instrumentation to troubleshoot an issue (Observability primer). If every incident starts with "let's add some logs and redeploy," you haven't reached that bar yet.

The cheapest place to reach it is the design doc. Add a short section that asks what you'll need to know when the happy path goes wrong, and answer it in concrete terms:

Question for the design docWhat it turns into
A customer says checkout is slow. Can we follow their one request through gateway, cart, payment, inventory and email?One trace ID propagated across every hop, including queues
A queue is growing. Is it slow producers, failing consumers, retries or a slow dependency?Rate, errors and duration on both sides of the queue, plus queue age
We flipped a feature flag. Are users on the new path doing worse?The flag variant recorded as an attribute on the request's spans
Support asks what happened to order 1042. Can someone outside this team answer?Business events with product names, searchable by order ID

Name the moments that matter

Not every line needs logging, and not every helper needs a metric. What you do want is a record of the transitions the business cares about, named in product language: payment_authorized, order_reserved, refund_rejected, invoice_sent. Someone who never read the code can follow that story. A line that says process failed may be true, but it won't help a tired teammate find which business step broke.

With OpenTelemetry, those moments can live on the span for the operation, next to the attributes you'll want to filter by later. Here's a small version using the JavaScript API:

import { trace, SpanStatusCode } from '@opentelemetry/api'

const tracer = trace.getTracer('checkout-service')

export function authorizePayment(order, gateway) {
  return tracer.startActiveSpan('payment.authorize', async (span) => {
    span.setAttribute('order.id', order.id)
    span.setAttribute('checkout.variant', order.checkoutVariant) // which flag path this user is on
    try {
      const result = await gateway.authorize(order)
      span.addEvent('payment_authorized')
      return result
    } catch (err) {
      span.recordException(err)
      span.setStatus({ code: SpanStatusCode.ERROR })
      throw err
    } finally {
      span.end()
    }
  })
}

Two lines here are design decisions. The span name and event name use the domain's words, and the flag variant goes on the span so "is the new checkout slower?" becomes a filter instead of a week-long investigation.

Carry one ID through everything

A trace ID created at the edge is small, almost boring work, and it changes every investigation that follows. Without it, each service keeps its own pile of evidence. With it, one customer request becomes one thread you can pull. The format is standard now: the W3C Trace Context recommendation defines a traceparent header that carries a version, a trace ID, the parent span ID and flags (Trace Context):

traceparent: 00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01

OpenTelemetry's default propagator uses exactly that header, and instrumentation libraries usually handle it for HTTP calls on their own (Context propagation). The trace usually breaks at the places auto-instrumentation can't see: a message queue, a scheduled job, a webhook from a partner, a hand-rolled HTTP client. Those are the spots to design for. For a queue, put the context into the message headers yourself:

import { context, propagation } from '@opentelemetry/api'

const headers = {}
propagation.inject(context.active(), headers) // adds traceparent
await broker.publish('order.placed', payload, { headers })

One warning from the same docs: OpenTelemetry also has baggage, which carries arbitrary key-value pairs along with the request. It travels to every downstream service and may get logged, so keep credentials, API keys and personal data out of it.

Once the ID travels, each signal has a clear job. Metrics tell you something is wrong. Traces show where the time went. Structured logs, tied to the trace, explain what happened at the important steps. Collecting more of each won't help much. Getting the three to line up does.

A design question

For every important workflow, ask: if this fails for exactly one customer, which ID lets us rebuild their path without guessing? If the answer is "we'd grep for their email," design the ID in now.

Choose what deserves attention

A system can drown a team in data and still hide the answer. Noisy logs bury the one line that matters. Metrics labeled with user IDs get expensive fast. Alerts that fire on every small wobble teach people to ignore alerts.

Google's SRE book gives two rules worth putting into the design itself. First, separate symptoms from causes: monitoring should answer "what's broken, and why?", and alerts should mostly page on what users feel, with cause-level signals kept for debugging. Second, every page should be actionable, and signals that never show up in a dashboard or alert are candidates for removal (Monitoring Distributed Systems). So an alert on "payment success rate dropped" earns its place. An alert on "one pod's CPU hit 80% for a minute" usually doesn't.

Evidence makes incidents less personal

There's a team side to this too. When the evidence is designed in, incident calls change tone. People look at the trace instead of guessing whose code caused it. A trace doesn't blame anyone, and a dashboard doesn't protect anyone's ego. It gives everyone on the call the same thing to look at, which matters when the room is already tense.

What it costs, and when to keep it light

Instrumentation takes engineering time. Dashboards need an owner or they rot. Logs and traces need retention rules, and storage bills grow with traffic. Someone has to decide which user journeys get an objective and which alerts are worth waking a person for.

Adding it later usually costs more, though. After an incident you end up debugging the failure and the missing evidence at the same time, under pressure, often with a redeploy in the middle just to see what's going on. That said, scale the effort to the stakes. A prototype or an internal script is fine with plain structured logs. A payment flow, a signup funnel or anything that pages someone deserves the full treatment from the first release.

Start with one workflow

You don't need a platform project to begin. Pick one workflow that matters, like signup, checkout, payout or report generation, and do this:

  • Name its key business events and record them on spans or structured logs.
  • Make sure one trace ID travels the whole path, including any queue in the middle.
  • Add RED metrics for each service involved: rate, errors and duration. Tom Wilkie came up with the RED method in 2015 as a service-oriented take on monitoring, and it's basically Google's four golden signals without saturation (The RED Method).
  • Build one dashboard that tells the story from the user's side.
  • Add one alert that would have helped in your last real incident.

Try this week

  • Add an "Observability" section to your design doc template with the four questions from the table above.
  • Pick one workflow and try to follow a single real request end to end. Write down every place the trail goes cold.
  • Check whether your message consumers continue the trace from the producer. If not, inject traceparent into message headers.
  • Rename one vague log line, like process failed, to the business event it really describes.
  • Review your alerts and delete or downgrade one that nobody has acted on in the last month.

Architecture covers how components call each other, and also how the system tells you the truth when something goes wrong. Pick one workflow this week and make sure that, the next time a customer gets stuck, it can tell you why.

What did you think?

Frequently asked questions

Why treat observability as a design decision?
Because the questions production asks depend on earlier choices: what events are named, which IDs travel between services and what gets measured. OpenTelemetry's bar is useful here: an application is properly instrumented when developers don't need to add more instrumentation to troubleshoot an issue.
What is a trace ID and how does it travel between services?
It's an identifier shared by every span in one request. The W3C Trace Context standard carries it in a traceparent header with a version, trace ID, parent span ID and flags. OpenTelemetry uses that header by default and usually handles HTTP calls automatically, but queues, scheduled jobs and webhooks often need you to inject and extract the context yourself.
What should I log?
The business transitions that matter, named in product language, such as payment_authorized or refund_rejected, with the IDs you'll search by. Skip logging every helper call. Structured logs tied to the trace ID are far more useful than many unrelated lines.
Which alerts are worth having?
Alerts on symptoms users feel, like a drop in payment success rate. Google's SRE book says every page should be actionable and that signals unused in any dashboard or alert are candidates for removal. Cause-level signals such as one machine's CPU are better kept for debugging.
Where should a team start with observability?
Pick one important workflow. Name its key business events, make one trace ID travel the whole path, add rate, errors and duration metrics for each service involved, build one user-facing dashboard, and add one alert that would have helped in your last real incident.