Skip to content

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
merged 10 commits into from
May 23, 2025

Conversation

SrdjanLL
Copy link
Contributor

@SrdjanLL SrdjanLL commented May 9, 2025

Description

  • Ensure spans complete early on stream closure for Bedrock Streaming APIs (ConverseStream, InvokeModelWithResponseStream)
    • Adding this covers cases when the stream .close() is called prematurely or prior to even consuming the stream.
    • Span closure is not treated as StatusCode.ERROR unless one is explicitly thrown (it will be StatusCode.UNSET instead, 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.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Unit tests

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@SrdjanLL SrdjanLL changed the title 500Ensure spans complete early on stream closure for Bedrock Streaming APIs Ensure spans complete early on stream closure for Bedrock Streaming APIs May 9, 2025
@SrdjanLL SrdjanLL changed the title Ensure spans complete early on stream closure for Bedrock Streaming APIs [WIP] Ensure spans complete early on stream closure for Bedrock Streaming APIs May 9, 2025
@SrdjanLL SrdjanLL force-pushed the botocore-stream-close-handle branch 2 times, most recently from d659757 to 2f022cc Compare May 9, 2025 13:51
@SrdjanLL SrdjanLL requested a review from a team as a code owner May 9, 2025 13:53
@SrdjanLL SrdjanLL force-pushed the botocore-stream-close-handle branch from ebb27e0 to 260f9d2 Compare May 9, 2025 14:05
@SrdjanLL SrdjanLL changed the title [WIP] Ensure spans complete early on stream closure for Bedrock Streaming APIs Ensure spans complete on early stream closure for Bedrock Streaming APIs May 9, 2025
@xrmx xrmx added the gen-ai Related to generative AI label May 9, 2025
@SrdjanLL SrdjanLL force-pushed the botocore-stream-close-handle branch from 260f9d2 to a2c2b43 Compare May 12, 2025 11:08
@SrdjanLL SrdjanLL requested a review from xrmx May 12, 2025 11:08
@SrdjanLL SrdjanLL force-pushed the botocore-stream-close-handle branch from a2c2b43 to ff15a02 Compare May 19, 2025 14:58
@SrdjanLL SrdjanLL force-pushed the botocore-stream-close-handle branch from ff15a02 to df1d4d4 Compare May 20, 2025 10:54
Copy link
Contributor

@xrmx xrmx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@xrmx xrmx enabled auto-merge (squash) May 23, 2025 08:12
@xrmx xrmx merged commit df27592 into open-telemetry:main May 23, 2025
720 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gen-ai Related to generative AI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants