{}DSA Atlas

Production Readiness — Observability, Deployment & Operations

Logs, metrics and traces with OpenTelemetry, RED/USE/golden signals, correlation IDs, health checks (liveness, readiness, startup), twelve-factor configuration, graceful shutdown, deployment strategies (rolling, blue-green, canary, feature flags), testing strategy, API documentation, and a production-readiness checklist.

Intermediate → Advanced6 interview questions

Observability

service A service B service C OTel SDK +Collector LogsLoki · Elasticsearch · CloudWatch MetricsPrometheus · Mimir · Datadog TracesTempo · Jaeger · Honeycomb all three correlated by trace_id → jump from an alert to the exact failing request
Instrument once with OpenTelemetry; send signals to any backend.

Structured logs with correlation

JSON
{"ts":"2026-10-07T10:21:03.412Z","level":"error","service":"payments","env":"prod",
 "trace_id":"4bf92f3577b34da6a3ce929d0e0e4736","span_id":"00f067aa0ba902b7",
 "request_id":"req_01J9ZK7T0X","user_id":"usr_42","route":"POST /v1/payments",
 "msg":"card declined","decline_code":"insufficient_funds","latency_ms":182}

Rules: JSON; consistent field names; include trace/request IDs; log events, not every line; never log secrets, tokens, full card numbers or unnecessary PII; sample noisy debug logs.

Metrics that matter

SignalMetricExample alert
Ratehttp_requests_total by route/statussudden drop to 0
Errors5xx ratio> 1% for 5 min (or SLO burn rate)
Durationlatency histogram → p50/p95/p99p99 > 500 ms for 10 min
SaturationCPU, memory, pool utilisation, queue depth, consumer lagqueue lag growing for 15 min

Distributed tracing

Python
from opentelemetry import trace

tracer = trace.get_tracer("payments")

def charge(order):
    with tracer.start_as_current_span("charge_card") as span:
        span.set_attribute("order.id", order.id)
        span.set_attribute("payment.amount_minor", order.total)
        result = psp_client.charge(order)            # auto-instrumented HTTP client adds a child span
        span.set_attribute("payment.status", result.status)
        return result

The W3C traceparent header propagates context across HTTP/gRPC/messaging so spans from every service join one trace.

Health checks

@app.get("/livez")          # liveness: am I alive? (no dependency checks)
def livez():
    return {"status": "ok"}

@app.get("/readyz")         # readiness: should I get traffic?
def readyz():
    if shutting_down or not warmed_up or not db_pool.healthy():
        return JSONResponse({"status": "not ready"}, status_code=503)
    return {"status": "ready"}
# Kubernetes
livenessProbe:  { httpGet: { path: /livez,  port: 8080 }, periodSeconds: 10, failureThreshold: 3 }
readinessProbe: { httpGet: { path: /readyz, port: 8080 }, periodSeconds: 5 }
startupProbe:   { httpGet: { path: /livez,  port: 8080 }, failureThreshold: 30, periodSeconds: 2 }

Configuration (twelve-factor)

  • Config in the environment (or a config service), not in code; same build artifact for every environment.
  • Secrets from a secrets manager.
  • Validate config at startup and fail fast.
  • Feature flags for runtime toggles (LaunchDarkly, Unleash, OpenFeature).

The twelve factors in one line each: one codebase; explicit dependencies; config in env; backing services as attached resources; separate build/release/run; stateless processes; port binding; scale out via processes; disposability (fast start, graceful stop); dev/prod parity; logs as event streams; admin tasks as one-off processes.

Graceful shutdown

Python
import asyncio, signal

shutting_down = False

async def main():
    server = await start_http_server()
    loop = asyncio.get_running_loop()
    stop = asyncio.Event()
    loop.add_signal_handler(signal.SIGTERM, stop.set)

    await stop.wait()
    global shutting_down
    shutting_down = True              # /readyz now returns 503
    await asyncio.sleep(5)            # let load balancers deregister us
    server.close()                    # stop accepting new connections
    await asyncio.wait_for(server.wait_closed(), timeout=20)   # drain in-flight requests
    await consumer.stop_and_commit()  # finish/ack current messages
    await db_pool.close()

Deployment strategies

Rolling replace instances in batches Blue–green blue v1 green v2 switch 100% at once; instant rollback Canary v1 · 95% v2 5% compare metrics, then widen Feature flags decouple deploy from release ship dark → enable for staff → 1% of users → 100% · kill switch if metrics degrade
Choose by risk tolerance, cost and rollback speed.
StrategyExtra capacityRollbackRisk exposureNotes
Recreatenoneredeployeveryone, with downtimedev/test only
Rollingsmallslow-ishgrows with rolloutKubernetes default
Blue-green2×instant switcheveryone at switch timeneeds schema compatibility
Canarysmallfast (shift traffic back)small % firstautomate analysis (Argo Rollouts, Flagger)
Shadow / dark launchdependsn/anone (responses discarded)test with real traffic

Testing strategy

LevelWhatNotes
Unitpure logicfast, many
IntegrationDB, cache, queuesreal dependencies in containers (Testcontainers)
ContractAPI compatibility between servicesconsumer-driven contracts (Pact), OpenAPI diff checks
End-to-endcritical user journeysfew, slow, flaky-prone
Load / stress / soakcapacity, limits, leaksk6, Gatling, Locust
Chaosresilience to failuresfault injection in staging/prod (with guard rails)
SecuritySAST, DAST, dependency scanningin CI

API documentation

  • OpenAPI spec as the source of truth (generate docs, SDKs, mocks, validation, contract tests).
  • Examples for every endpoint, error catalogue, auth guide, rate-limit policy, changelog, deprecation schedule.
  • Sandbox environment and test API keys for external developers.

Production-readiness checklist

  • SLOs defined; dashboards + alerts on SLO burn
  • Timeouts, retries (with jitter), circuit breakers on every dependency
  • Rate limiting and input size limits
  • AuthN/AuthZ on every endpoint (object-level)
  • Liveness/readiness probes; graceful shutdown
  • Autoscaling + load-tested capacity; multi-AZ
  • Structured logs, metrics, traces with correlation IDs
  • Secrets in a manager; least-privilege IAM
  • Backups and a tested restore procedure
  • Safe deployments (canary/blue-green) and backward-compatible migrations
  • Runbooks, on-call ownership, dependency map
  • Data classification, retention and deletion (GDPR/DPDP)

Interview questions

0 / 6 marked confident

Answer out loud first, then open the model answer. Mark a question confident only when you could explain it to an interviewer without notes.