The Silent Failure

Difficulty: MEDIUMID: obs-tracing-001

The Scenario

User reports: "I clicked 'Generate' and nothing happened." Your API logs show: 200 OK. The error happened deep in a microservice chain: API -> Orchestrator -> VectorDB -> LLM.

Without tracing, you have no idea which service failed or why.

The Problem

Your services swallow exceptions and return generic messages.

try:
    call_downstream()
except Exception:
    return None  # The error is lost forever

The Goal

Implement Trace ID Propagation:

  1. Accept a trace_id from the upstream caller.
  2. Log the trace_id with every error message.
  3. Pass the trace_id to the downstream service.

Requirements:

  • Function process_request(trace_id)
  • Log errors using print(f"[ERROR] [{trace_id}] ...")
  • Pass trace_id to call_service_b(trace_id)
solution.py
Loading...
⚠️ Do not include PII or secrets in your code.
SYSTEM_LOGS
5/5
// Waiting for execution trigger...