Commit 72625db
authored
[PATCH] Add safety check for bedrock ConverseStream responses (#547)
*Description of changes:*
Ports the changes from
open-telemetry/opentelemetry-python-contrib#3990
Add defensive check for Bedrock responses missing expected structure.
When no messageStart event with assistant role is received, the response
may lack the standard output.message format, causing the occasional
KeyError exceptions.
For testing, I was unable to reproduce the exact scenario that would
trigger this bug, however, this safety check would fix this issue
without affecting normal instrumentation behavior.
By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.1 parent 54c5f11 commit 72625db
File tree
3 files changed
+32
-1
lines changed- aws-opentelemetry-distro
- src/amazon/opentelemetry/distro/patches
- tests/amazon/opentelemetry/distro/patches
3 files changed
+32
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
26 | 28 | | |
Lines changed: 20 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
337 | | - | |
| 337 | + | |
338 | 338 | | |
339 | 339 | | |
| 340 | + | |
340 | 341 | | |
341 | 342 | | |
342 | 343 | | |
| |||
412 | 413 | | |
413 | 414 | | |
414 | 415 | | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
415 | 433 | | |
416 | 434 | | |
417 | 435 | | |
418 | 436 | | |
419 | 437 | | |
420 | 438 | | |
| 439 | + | |
421 | 440 | | |
422 | 441 | | |
423 | 442 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
| 253 | + | |
253 | 254 | | |
254 | 255 | | |
255 | 256 | | |
| |||
645 | 646 | | |
646 | 647 | | |
647 | 648 | | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
648 | 658 | | |
649 | 659 | | |
650 | 660 | | |
| |||
0 commit comments