feat(llmobs): activate APM scope for standalone agent spans - #12347
Draft
yahya-mouman wants to merge 1 commit into
Draft
feat(llmobs): activate APM scope for standalone agent spans#12347yahya-mouman wants to merge 1 commit into
yahya-mouman wants to merge 1 commit into
Conversation
…ve trace-ID consistency When an agent span is its own APM local root (no ambient APM parent), activate it as the current APM scope. Without this, each subsequent DDLLMObsSpan starts a fresh APM root with a different trace ID, causing the trace-ID consistency gate in the constructor to reject parent_id and session_id inheritance, resulting in a flat LLMObs trace with no hierarchy. Also adds cleanup blocks to Groovy tests where LLMOBS_AGENT_SPAN_KIND spans were leaking scopes, and adds JUnit tests verifying standalone vs non-standalone scope activation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4 tasks
Contributor
|
🎯 Code Coverage (details) 🔗 Commit SHA: 1207e73 | Docs | View more details | Give us feedback! |
Contributor
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
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.
Summary
standaloneApmScope.DDLLMObsSpaninside the same workflow starts a fresh APM root with a different trace ID, causing the trace-ID consistency gate in theDDLLMObsSpanconstructor to rejectparent_idandsession_idinheritance — resulting in a flat LLMObs trace with no hierarchy.standaloneApmScopeisnulland no additional scope is opened.This is a follow-up to #12238 (agent attribution), extracted into its own PR because it's a standalone behavioral change with its own tests.
Test plan
DDLLMObsSpanStandaloneApmScopeTest:standaloneAgentSpanActivatesApmScopeForOutgoingPropagation— verifiesstandaloneApmScopeis non-null when no ambient APM parentnonStandaloneAgentSpanDoesNotActivateApmScope— verifiesstandaloneApmScopeis null when an APM parent already existscleanup: test.finish()to the twoDDLLMObsSpanTesttests that useLLMOBS_AGENT_SPAN_KINDto prevent scope leakage🤖 Generated with Claude Code