Ensure spans complete on early stream closure for Bedrock Streaming APIs#3481
Merged
xrmx merged 10 commits intoopen-telemetry:mainfrom May 23, 2025
Merged
Ensure spans complete on early stream closure for Bedrock Streaming APIs#3481xrmx merged 10 commits intoopen-telemetry:mainfrom
xrmx merged 10 commits intoopen-telemetry:mainfrom
Conversation
d659757 to
2f022cc
Compare
ebb27e0 to
260f9d2
Compare
xrmx
reviewed
May 9, 2025
260f9d2 to
a2c2b43
Compare
5 tasks
a2c2b43 to
ff15a02
Compare
18 tasks
xrmx
reviewed
May 20, 2025
…t that span status is unset.
ff15a02 to
df1d4d4
Compare
xrmx
reviewed
May 23, 2025
sightseeker
added a commit
to sightseeker/opentelemetry-python-contrib
that referenced
this pull request
Mar 11, 2026
…PIs (open-telemetry#3481) * Ensure spans end on early stream closure for Bedrock Streaming APIs * Add changelog * End span only if it's still recording in stream done callbacks. Assert that span status is unset. * Extract response output and stream content into helper functions * Update changelog after 1.33.0 release * Keep track of bedrock stream ending and close spans accordingly * Move stream output checks to a single method * Update CHANGELOG.md --------- Co-authored-by: Riccardo Magliocchetti <[email protected]>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
ConverseStream,InvokeModelWithResponseStream).close()is called prematurely or prior to even consuming the stream.StatusCode.ERRORunless one is explicitly thrown (it will beStatusCode.UNSETinstead, with fewer attributes captured).This improvement was surfaced as part of the bedrock instrumentation tracking issue: #3210
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.