Skip to content

revert(runtime): flush tracing spans after invocations (#721) - #731

Merged
aidandaly24 merged 1 commit into
mainfrom
revert/runtime-flush-tracer-provider
Nov 3, 2026
Merged

aidandaly24 merged 1 commit into
mainfrom
revert/runtime-flush-tracer-provider

Conversation

@jariy17

@jariy17 jariy17 commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

What

Reverts #721 (343da26), which made /invocations responses wait on TracerProvider.force_flush() before closing.

Why

  • The flush puts the OTLP export on the request path. In VPC network mode without a route to X-Ray, the export connection never completes, so streaming responses deliver every event but never close, and clients time out (boto3 ReadTimeoutError). The sync stream path had no cap on the wait.
  • The problem fix(runtime): flush tracing spans after invocations #721 addressed doesn't reproduce. We ran SDK 1.25.1 (no flush) on AgentCore Runtime with default lifecycle settings (900 s idle, 8 h max lifetime), public network, us-west-2, on both code-zip and container runtimes:
Artifact Runs Process after response Span (default BatchSpanProcessor) exported
code-zip 2 Kept running until the idle timeout (~+910 s), no gaps +4.5 s
container 2 Kept running until the idle timeout (~+905 s), no gaps +3.5 s

The microVM isn't frozen after the response; it keeps running until the idle timeout. BatchSpanProcessor's normal 5 s export covers request spans without an explicit flush.

Reopens #629 to find out what dropped spans in that environment.

Testing

  • pytest tests/bedrock_agentcore/runtime: 349 passed
  • ruff check / ruff format --check: clean

This reverts commit 343da26.

The flush made every response wait on the OTLP export. In VPC network mode
without a route to X-Ray the export never connects, so streams stayed open
until the client timed out. A repro on AgentCore Runtime found no microVM
freeze after the response: a background thread kept running for 120 s in
9/9 runs, so BatchSpanProcessor's own export already covers the case #629
described.

Reopens #629.
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

✅ No Breaking Changes Detected

No public API breaking changes found in this PR.

@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Nov 3, 2026

@aidandaly24 aidandaly24 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tested it and it works well

@aidandaly24
aidandaly24 merged commit 62c3c73 into main Nov 3, 2026
44 of 45 checks passed

This branch was previously deployed

1 inactive deployment
auto-approve — ec60329d Deployed Nov 3, 2026 by jariy17 via Test (tools) #1687
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants