Commit 0d1bda1
serviceevents: gate error breakdown on faults (5xx) only (#783)
## What
Gate the per-error `error_breakdown` (and the `EndpointErrorMetric`
`count` data points it feeds) on **faults (5xx) only**, and stop
synthesizing an `"UnknownError"` entry when no real exception type was
captured.
The breakdown is now populated only for a request with `status_code >=
500` **and** a captured exception type. A 4xx still increments the
aggregate `errors` counter but produces no breakdown entry; a 5xx that
returned a 500 without a captured exception produces no synthetic entry.
## Changes
- **Gate `>= 400` → `>= 500`** in `endpoint_collector.py`.
- **No synthetic `UnknownError`**: `_extract_error_from_call_path`
returns `None` (was a synthetic `{"error_type": "UnknownError",
"function_name": "unknown"}` dict) when no real type can be resolved, so
callers omit the breakdown.
- The collector indexes `error_info` directly (the extractor is the sole
producer of a complete-or-`None` dict), so no synthetic default can
silently resurface.
## Tests
- Fault-only gate (4xx excluded from breakdown, still counted as an
error).
- 5xx-without-exception omission across Flask / Django / FastAPI.
- The `None`-return extractor contract.
Lint clean: `black`, `isort`, `flake8`, `codespell` all pass;
serviceevents suite green (716 passing).
Co-authored-by: ADOT Patch workflow <adot-patch-workflow@github.com>1 parent e3a2ff7 commit 0d1bda1
6 files changed
Lines changed: 118 additions & 20 deletions
File tree
- aws-opentelemetry-distro
- src/amazon/opentelemetry/distro/serviceevents
- collectors
- instrumentation
- tests/amazon/opentelemetry/distro/serviceevents
- collectors
- instrumentation
Lines changed: 11 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
156 | 163 | | |
157 | 164 | | |
158 | 165 | | |
| |||
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
389 | 389 | | |
390 | 390 | | |
391 | 391 | | |
392 | | - | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
393 | 399 | | |
394 | 400 | | |
395 | 401 | | |
| |||
Lines changed: 49 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
217 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
218 | 223 | | |
219 | 224 | | |
220 | 225 | | |
| |||
224 | 229 | | |
225 | 230 | | |
226 | 231 | | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
227 | 239 | | |
228 | 240 | | |
229 | 241 | | |
230 | | - | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
231 | 267 | | |
232 | 268 | | |
233 | 269 | | |
| |||
406 | 442 | | |
407 | 443 | | |
408 | 444 | | |
409 | | - | |
410 | | - | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
411 | 453 | | |
412 | 454 | | |
413 | 455 | | |
| |||
438 | 480 | | |
439 | 481 | | |
440 | 482 | | |
441 | | - | |
| 483 | + | |
442 | 484 | | |
443 | 485 | | |
444 | 486 | | |
445 | | - | |
| 487 | + | |
446 | 488 | | |
447 | | - | |
448 | 489 | | |
449 | 490 | | |
450 | 491 | | |
| |||
Lines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
624 | 624 | | |
625 | 625 | | |
626 | 626 | | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
627 | 663 | | |
628 | 664 | | |
629 | 665 | | |
| |||
Lines changed: 10 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
398 | 398 | | |
399 | 399 | | |
400 | 400 | | |
401 | | - | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
402 | 409 | | |
403 | 410 | | |
404 | 411 | | |
| |||
423 | 430 | | |
424 | 431 | | |
425 | 432 | | |
426 | | - | |
| 433 | + | |
427 | 434 | | |
428 | | - | |
| 435 | + | |
429 | 436 | | |
430 | 437 | | |
431 | 438 | | |
| |||
Lines changed: 5 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
137 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
138 | 140 | | |
139 | 141 | | |
140 | 142 | | |
141 | 143 | | |
142 | 144 | | |
143 | | - | |
144 | | - | |
| 145 | + | |
145 | 146 | | |
146 | 147 | | |
147 | 148 | | |
| |||
0 commit comments