123DevOps··5 min read

Reducing MTTR without blowing the budget: instrumentation with business context

Where recovery time is really lost, how to add business context to traces without exploding cardinality, business metrics as the first alarm, and how to spend telemetry where it matters.

Observability

There’s an easy answer to reducing MTTR (mean time to recovery): collect everything, store everything, for a long time. It works until the observability bill overtakes the infrastructure bill. The hard answer, and the one the market is looking for, is to collect the right context, so that diagnosis is fast and the budget stays under control.

Where recovery time is lost

MTTR is the sum of very different phases:

Phase Question What speeds it up
Detection (MTTD) Does anyone know there’s a problem? Symptom-based alerts and business metrics
Acknowledgment Is the right person looking? Routing by service owner, clear on-call
Diagnosis What’s wrong and why? Context, correlation between signals, recent changes
Mitigation How do we stop the impact? Fast rollback, feature flags, runbooks

In most incidents, the longest phase is diagnosis, and that’s exactly where instrumentation makes a difference. Before buying more tools, measure how long each phase took in your last postmortems.

Business context: the question infrastructure can’t answer

During an incident, the real questions are business questions:

  • Who is being affected? All customers, or only those on the enterprise plan?
  • What is failing? Every payment, or only Pix (Brazil’s instant payment system)? All shipping, or only one carrier?
  • Since when, and after which change? A new version? A feature flag that was turned on?

CPU and memory metrics answer none of them. Business attributes on spans answer all of them.

Instrumenting with context

With OpenTelemetry, adding context takes one line per attribute:

from opentelemetry import trace

tracer = trace.get_tracer("checkout")


def complete_order(order, customer, flags):
    with tracer.start_as_current_span("checkout.complete_order") as span:
        span.set_attribute("app.customer.plan", customer.plan)
        span.set_attribute("app.customer.id", customer.id)  # fine in traces, NEVER in metrics
        span.set_attribute("app.order.payment_method", order.payment_method)
        span.set_attribute("app.order.item_count", len(order.items))
        span.set_attribute("app.feature_flag.new_shipping", flags.is_enabled("new_shipping"))
        ...

Best practices:

  • Your own prefix (app.) so you don’t collide with the semantic conventions.
  • No personal data: internal identifiers, yes; name, email, and government ID numbers, no.
  • Propagation across services: use OpenTelemetry baggage to carry the plan or the tenant from the gateway to internal services, so each one doesn’t have to look it up.
  • Feature flags and version on every span: most incidents start with a change.

The golden rule of cardinality

The app.customer.id attribute has millions of possible values. That’s great in traces and logs (each event is independent) and disastrous in metrics (each value becomes a new time series; see the article on cardinality in Prometheus and Mimir).

The split that works:

Attribute type Examples Where to use
Low cardinality plan, payment method, region, version Metrics, traces, and logs
High cardinality customer ID, order ID, full URL Traces and logs only

With this, the metrics dashboard shows “errors by payment method” and, with one click, the traces show which customers were affected.

Business metrics as the first alarm

Many failures don’t produce a technical error: a front-end bug that hides the buy button, an integration that accepts the order but never processes it. Business metrics catch what infrastructure can’t see:

  • Orders completed per minute;
  • Payment approval rate by payment method;
  • Sign-ups started versus completed;
  • Messages processed versus received in a queue.

A sharp drop compared with the same time the previous week is often the fastest signal that something is wrong, frequently before any technical alert fires.

Visible changes

Put markers for deploys, configuration changes, and feature flag activations on your dashboards. During diagnosis, the first question should be answered in seconds: “what changed right before the chart changed?”. GitOps and feature flag tools can send these events to the observability platform automatically.

Spending telemetry where it matters

Not every service deserves the same level of detail. Define tiers:

Tier Services Traces Logs Retention in the hot tool
1 — Critical Checkout, payments, login Tail sampling with 100% of errors and slow requests INFO+ 30 days
2 — Important Catalog, search, notifications 10% sampling + errors WARN+ 15 days
3 — Internal Jobs, internal tools Errors only ERROR 7 days

Combined with telemetry pipelines and a cheap archive, this keeps detail where MTTR matters and cuts cost where it doesn’t.

What’s ready before the incident

  • A service catalog with owner, on-call, dependencies, and links to dashboards;
  • A standard dashboard per service: RED, saturation, dependencies, deploys, and business metrics;
  • Runbooks linked from every alert;
  • Fast mitigations ready to go: one-click rollback, feature flags to turn features off, degraded mode.

Measuring improvement

  • MTTD and MTTR by severity, every quarter;
  • Time spent in each phase, extracted from postmortems;
  • Percentage of incidents detected by alerts versus by customers or support;
  • Observability cost per service and as a percentage of infrastructure cost.

Checklist

  • MTTR phases measured in postmortems
  • Business attributes on spans in critical flows
  • High cardinality only in traces and logs
  • Business metrics with drop alerts
  • Deploys and feature flags marked on dashboards
  • Telemetry tiers by service criticality
  • Runbook and owner on every alert

Reducing MTTR isn’t about having more data. It’s about having, at the moment of the incident, the data that answers the business question, and only paying a premium for it where it matters.

Get updates on new posts and stay in the loop!