-
Notifications
You must be signed in to change notification settings - Fork 805
Ensure spans complete on early stream closure for Bedrock Streaming APIs #3481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
xrmx
merged 10 commits into
open-telemetry:main
from
SrdjanLL:botocore-stream-close-handle
May 23, 2025
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c09a3c2
Ensure spans end on early stream closure for Bedrock Streaming APIs
SrdjanLL 8d9d5ca
Add changelog
SrdjanLL 7df8441
End span only if it's still recording in stream done callbacks. Asser…
SrdjanLL 55e6448
Extract response output and stream content into helper functions
SrdjanLL de319a2
Update changelog after 1.33.0 release
SrdjanLL 6a5b2ac
Keep track of bedrock stream ending and close spans accordingly
SrdjanLL df1d4d4
Move stream output checks to a single method
SrdjanLL 0222c54
Merge branch 'main' into botocore-stream-close-handle
xrmx 6207af1
Update CHANGELOG.md
xrmx 1a42e4d
Merge branch 'main' into botocore-stream-close-handle
xrmx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
...strumentation-botocore/tests/cassettes/test_converse_stream_close_before_consumption.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| interactions: | ||
| - request: | ||
| body: |- | ||
| { | ||
| "messages": [ | ||
| { | ||
| "role": "user", | ||
| "content": [ | ||
| { | ||
| "text": "Say this is a test" | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "inferenceConfig": { | ||
| "maxTokens": 10, | ||
| "temperature": 0.8, | ||
| "topP": 1, | ||
| "stopSequences": [ | ||
| "|" | ||
| ] | ||
| } | ||
| } | ||
| headers: | ||
| Content-Length: | ||
| - '170' | ||
| Content-Type: | ||
| - application/json | ||
| User-Agent: | ||
| - Boto3/1.35.56 md/Botocore#1.35.56 ua/2.0 os/macos#24.4.0 md/arch#arm64 lang/python#3.12.0 | ||
| md/pyimpl#CPython cfg/retry-mode#legacy Botocore/1.35.56 | ||
| X-Amz-Date: | ||
| - 20250509T104610Z | ||
| X-Amz-Security-Token: | ||
| - test_aws_security_token | ||
| X-Amzn-Trace-Id: | ||
| - Root=1-98fd1391-6f6d1be3cc209d9ba2fb3034;Parent=6dc095915efed44e;Sampled=1 | ||
| amz-sdk-invocation-id: | ||
| - 3a37ec88-d989-4397-bfbe-d463b66a3a08 | ||
| amz-sdk-request: | ||
| - attempt=1 | ||
| authorization: | ||
| - Bearer test_aws_authorization | ||
| method: POST | ||
| uri: https://bedrock-runtime.us-east-1.amazonaws.com/model/amazon.titan-text-lite-v1/converse-stream | ||
| response: | ||
| body: | ||
| string: !!binary | | ||
| AAAApAAAAFJl4NbnCzpldmVudC10eXBlBwAMbWVzc2FnZVN0YXJ0DTpjb250ZW50LXR5cGUHABBh | ||
| cHBsaWNhdGlvbi9qc29uDTptZXNzYWdlLXR5cGUHAAVldmVudHsicCI6ImFiY2RlZmdoaWprbG1u | ||
| b3BxcnN0dXZ3eHl6QUJDREVGR0hJSktMTSIsInJvbGUiOiJhc3Npc3RhbnQifSKBqDQAAADZAAAA | ||
| VxTIBhYLOmV2ZW50LXR5cGUHABFjb250ZW50QmxvY2tEZWx0YQ06Y29udGVudC10eXBlBwAQYXBw | ||
| bGljYXRpb24vanNvbg06bWVzc2FnZS10eXBlBwAFZXZlbnR7ImNvbnRlbnRCbG9ja0luZGV4Ijow | ||
| LCJkZWx0YSI6eyJ0ZXh0IjoiSGksIGRpZCB5b3UgaGF2ZSBhIHF1ZXN0aW9uIn0sInAiOiJhYmNk | ||
| ZWZnaGlqa2xtbm9wcXJzdHV2d3h5ekFCQ0RFRkdISUpLIn22h6U3AAAAqgAAAFbdvayfCzpldmVu | ||
| dC10eXBlBwAQY29udGVudEJsb2NrU3RvcA06Y29udGVudC10eXBlBwAQYXBwbGljYXRpb24vanNv | ||
| bg06bWVzc2FnZS10eXBlBwAFZXZlbnR7ImNvbnRlbnRCbG9ja0luZGV4IjowLCJwIjoiYWJjZGVm | ||
| Z2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0wifQSjvQkAAAChAAAAUTQJCC0LOmV2ZW50 | ||
| LXR5cGUHAAttZXNzYWdlU3RvcA06Y29udGVudC10eXBlBwAQYXBwbGljYXRpb24vanNvbg06bWVz | ||
| c2FnZS10eXBlBwAFZXZlbnR7InAiOiJhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ekFCQ0QiLCJz | ||
| dG9wUmVhc29uIjoibWF4X3Rva2VucyJ9jxPapgAAAMsAAABOaoNqNAs6ZXZlbnQtdHlwZQcACG1l | ||
| dGFkYXRhDTpjb250ZW50LXR5cGUHABBhcHBsaWNhdGlvbi9qc29uDTptZXNzYWdlLXR5cGUHAAVl | ||
| dmVudHsibWV0cmljcyI6eyJsYXRlbmN5TXMiOjYyNX0sInAiOiJhYmNkZWZnaGlqa2wiLCJ1c2Fn | ||
| ZSI6eyJpbnB1dFRva2VucyI6OCwib3V0cHV0VG9rZW5zIjoxMCwidG90YWxUb2tlbnMiOjE4fX0B | ||
| /Sts | ||
| headers: | ||
| Connection: | ||
| - keep-alive | ||
| Content-Type: | ||
| - application/vnd.amazon.eventstream | ||
| Date: | ||
| - Fri, 09 May 2025 10:46:10 GMT | ||
| Set-Cookie: test_set_cookie | ||
| Transfer-Encoding: | ||
| - chunked | ||
| x-amzn-RequestId: | ||
| - 5aaaa521-d2c6-4980-ba0a-7bba19633a40 | ||
| status: | ||
| code: 200 | ||
| message: OK | ||
| version: 1 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.