Commit 8de6ebf
fix: Tune timeouts on dbt platform httpx clients (#803)
## Summary
- Set explicit timeouts on all `httpx.AsyncClient()` calls that hit dbt
platform APIs
- Timeout values based on production latency data (Datadog spans, last 7
days)
- Tiered by API latency profile rather than one-size-fits-all
## Why
`httpx.AsyncClient()` defaults to a 5-second timeout. For Admin API
calls like `GET /runs/{id}/`, the p99 latency is 5.0s, meaning ~1% of
requests hit the timeout. This caused `ReadTimeout` errors in
production.
**82 errors over the last 14 days, accelerating**: 5-6/day in week 1,
10-17/day in week 2. The last 3 full days (Jun 8-10) accounted for 50%
of all errors.
Top 3 tools by error count: `list_metrics` (22), `get_dimensions` (20),
`get_job_run_error` (19), accounting for 74% of all timeouts. A single
account (46429) produced 46% of all errors.
## Timeout values
| Client | Old timeout | New timeout | Justification |
|---|---|---|---|
| Admin API (`dbt_admin/client.py`) | 5s (default) | **15s** | p99 =
5.0s, max = 5.3s; 15s gives ~3x headroom |
| Discovery API (`discovery/client.py`) | 5s (default) | **15s** | p99 =
3.8s (worst cluster), max = 77s (outlier); 15s covers normal operation |
| Project/env resolvers | 5s (default) | **15s** | Same platform API
endpoints as Admin API |
| Semantic Layer GQL (`gql_request.py`) | 30s | **60s** | Schema
operations reach 38.7s max; 60s gives ~1.5x headroom |
Product docs clients (fetching from external docs sites) retain their
existing explicit timeouts (30s, 120s).
## Test plan
- [x] `ruff check` and `ruff format` pass
- [x] 748 unit tests pass (rebased on latest main)
- [ ] Verify ReadTimeout error rate drops in production after deploy
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent d32acf3 commit 8de6ebf
6 files changed
Lines changed: 16 additions & 7 deletions
File tree
- .changes/unreleased
- src/dbt_mcp
- config
- dbt_admin
- discovery
- project
- semantic_layer/gql
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
46 | | - | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
394 | 395 | | |
395 | 396 | | |
396 | 397 | | |
397 | | - | |
| 398 | + | |
398 | 399 | | |
399 | 400 | | |
400 | 401 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
362 | 363 | | |
363 | 364 | | |
364 | 365 | | |
365 | | - | |
| 366 | + | |
366 | 367 | | |
367 | 368 | | |
368 | 369 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | | - | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | | - | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
56 | | - | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | | - | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
0 commit comments