# What happens to your app when the tracing backend fails: Langfuse vs Braintrust SDK (4 Nov 2026, IST)

A tiny Python function decorated for tracing (`@observe()` for Langfuse, `@traced` with `init_logger(project=...)` for Braintrust) is called 3 times while the backend is: missing a key (`nokey`), rejecting the key with HTTP 401 (`badkey`, local sink on port 14401), or unreachable (`unreachable`, 127.0.0.1:9). No vendor account, dummy keys, no spend.
Box: Linux, Python 3.13 venvs (uv). Run on the morning of 4 Nov 2026 (last run 11:26 IST), 1 run per case.

Versions: langfuse 5.1.0, braintrust 0.49.2.

## Results (raw/summary.txt, raw/*.out, raw/sink-401.jsonl)

| Case | Langfuse 5.1.0 | Braintrust 0.49.2 |
|---|---|---|
| Function result / exit code | 'Paris', exit 0 in all cases | 'Paris', exit 0 in all cases |
| No key | One warning, client disabled, nothing sent. Process total 0.31 s. 7 output lines. | `init_logger` returned at once; at exit it retried (1 s, 2 s), then "Failed to construct log records to flush after 3 attempts. Dropping batch". 3.49 s, 107 output lines with tracebacks. |
| Key rejected (401) | One export of 3 spans to /api/public/otel/v1/traces, one line "Failed to export spans batch code: 401, reason: Unauthorized". 0.37 s. | 3 POSTs to /api/apikey/login (all 401), ValueError "Invalid API key" tracebacks, then "Dropping batch". 3.25 s, 257 lines. |
| Unreachable | Retries, then "Failed to export spans batch due to timeout, max retries or shutdown." 3.26 s. | Retries, then "Dropping batch". 13.76 s, 449 lines. |

Per-call overhead inside the process: Langfuse's first decorated call took ~45-60 ms (exporter set-up) when a key was set, later calls ~0.2 ms; Braintrust calls ~1 ms first, ~0.1 ms after.

Takeaway: neither SDK broke the function or changed its exit code. Both drop the traces when the backend is down. The difference is noise and shutdown time: Braintrust's retries add seconds at exit and print long tracebacks to stderr, which matters for CLI tools, CI jobs and log costs.

## Caveats
- Total times include Python start-up and imports; they are not benchmarks.
- One run per case on a local loopback; real network timeouts may be longer.
- Defaults only; both SDKs have settings for retries, timeouts and disabling.

Files: `app.py`, `sink.py`, `run.sh`, `raw/`.
