Commit 015ccb5
authored
[fix][backend] add MaxBytes limit to ListSpansRepeat to prevent… (#568)
[fix][observability] add MaxBytes limit to ListSpansRepeat to prevent OOM in trajectory backfill
When a traceID contains a large number of spans, ListSpansRepeat would
fetch all pages into memory without any bound, potentially causing OOM
in TCE instances during backfill tasks.
This adds a configurable MaxBytes parameter to ListSpansRepeat. When the
accumulated span size exceeds the limit, it returns ErrMaxBytesExceeded.
GetTrajectories catches this error, logs a warning, and returns an empty
trajectory map to skip oversized traces gracefully.
The limit is configured per workspace via BackfillConfig.TrajectoryMaxBytes.
When unset (0), the original unlimited behavior is preserved.1 parent 3f01307 commit 015ccb5
5 files changed
Lines changed: 38 additions & 0 deletions
File tree
- backend/modules/observability
- domain
- component/config
- trace
- repo
- service
- infra/repo
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
| 153 | + | |
152 | 154 | | |
153 | 155 | | |
154 | 156 | | |
| |||
166 | 168 | | |
167 | 169 | | |
168 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
169 | 176 | | |
170 | 177 | | |
171 | 178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| 14 | + | |
| 15 | + | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
| |||
46 | 49 | | |
47 | 50 | | |
48 | 51 | | |
| 52 | + | |
49 | 53 | | |
50 | 54 | | |
51 | 55 | | |
| |||
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
2489 | 2490 | | |
2490 | 2491 | | |
2491 | 2492 | | |
| 2493 | + | |
| 2494 | + | |
| 2495 | + | |
| 2496 | + | |
| 2497 | + | |
2492 | 2498 | | |
2493 | 2499 | | |
2494 | 2500 | | |
| |||
2506 | 2512 | | |
2507 | 2513 | | |
2508 | 2514 | | |
| 2515 | + | |
2509 | 2516 | | |
2510 | 2517 | | |
| 2518 | + | |
| 2519 | + | |
| 2520 | + | |
| 2521 | + | |
2511 | 2522 | | |
2512 | 2523 | | |
2513 | 2524 | | |
| |||
2520 | 2531 | | |
2521 | 2532 | | |
2522 | 2533 | | |
| 2534 | + | |
2523 | 2535 | | |
2524 | 2536 | | |
| 2537 | + | |
| 2538 | + | |
| 2539 | + | |
| 2540 | + | |
2525 | 2541 | | |
2526 | 2542 | | |
2527 | 2543 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| 132 | + | |
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
| 299 | + | |
299 | 300 | | |
300 | 301 | | |
301 | 302 | | |
302 | 303 | | |
303 | 304 | | |
304 | 305 | | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
305 | 315 | | |
306 | 316 | | |
307 | 317 | | |
| |||
0 commit comments