feat(runtime): add session.id OTel baggage propagation - #142
Conversation
6b946b9 to
1416683
Compare
Read X-Amzn-Bedrock-AgentCore-Runtime-Session-Id from inbound requests and inject into OTel Baggage as session.id. This enables downstream services to receive session context via W3C baggage header, and completes the circuit for SessionBaggageSpanProcessor in the OTel extension (PR spring-ai-community#112) which reads session.id from baggage. - AgentCoreSessionBaggageFilter: servlet filter that sets baggage - AgentCoreBaggagePropagationAutoConfiguration: activates only when OTel API is on classpath, targets /invocations only - Disableable via spring.ai.agentcore.baggage.enabled=false - 10 tests covering filter behavior and auto-configuration Closes spring-ai-community#71 (baggage propagation component) Related: spring-ai-community#72, spring-ai-community#112
1416683 to
3b498c9
Compare
|
End-to-end validation Setup: JDK 21 + Maven, branch built clean (BUILD SUCCESS). Added an integration test that boots Tomcat on a random port (@SpringBootTest(webEnvironment = RANDOM_PORT)) and registers the production AgentCoreSessionBaggageFilter plus the real W3CBaggagePropagator. What the test exercises: Inbound - sends a real HTTP POST with X-Amzn-Bedrock-AgentCore-Runtime-Session-Id: sess-e2e-12345. The filter injects it into OTel Baggage as session.id, and the endpoint reads it back from Baggage.current(). Outbound - the endpoint calls W3CBaggagePropagator.inject() on the current context, exactly as an OTel-instrumented HTTP client would for a downstream call. The serialized header comes out as baggage: session.id=sess-e2e-12345. Result: all tests green. AgentCoreSessionBaggageFilterTests ............... 5/5 Note: when the test endpoint was first mapped to /invocations it collided with the starter's own AgentCoreInvocationsController, so I mapped the integration endpoint to a dedicated path and registered the real filter there. The production auto-configuration still targets /invocations only — that was a test-harness detail, not a behavior change. I can fold this integration test into the PR if you'd like it kept as a permanent regression guard. Integration test source @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) } |
|
@vaquarkhan: two points:
|
Read X-Amzn-Bedrock-AgentCore-Runtime-Session-Id from inbound requests and inject into OTel Baggage as session.id. This enables downstream services to receive session context via W3C baggage header, and completes the circuit for SessionBaggageSpanProcessor in the OTel extension (PR #112) which reads session.id from baggage.
Closes #71 (baggage propagation component)
Related: #72, #112