Repository navigation
refactor: abstract llmobs from anthropic contrib using the subscriber pattern - #20760
emmettbutler wants to merge 15 commits into
Conversation
❌ ErrorsYour PR has failed checks. Please review the issues below and take necessary action before merging. 🚦 1 Pipeline job failed
ℹ️ InfoNo other issues found (see more)🧪 All tests passed Useful? React with 👍 / 👎 This comment will be updated automatically if new data arrives.🔗 Commit SHA: 3bcbf5b | Docs | View more details | Give us feedback! |
Codeowners resolved asResolved from the full PR diff against |
Circular import analysis
|
Dependency direction analysis📈 Existing violations got worse5 pre-existing violation(s) increased in severity (e.g. their target became more depended-on, or got pulled into an import cycle), though the edge itself isn't new:
|
There was a problem hiding this comment.
💡 Codex Review
This move adds deprecated AIDEV-NOTE: labels to a new file (and repeats one in TracedAsyncStream). The repository's CI checker inspects added diff lines rather than matching moved content, so these labels are reported as violations and block the commit; replace them with plain inline comments.
AGENTS.md reference: AGENTS.md:L151-L154
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
BenchmarksBenchmark execution time: 2026-10-09 17:39:09 Comparing candidate commit 3bcbf5b in PR branch Found 0 performance improvements and 4 performance regressions! Performance is the same for 370 metrics, 9 unstable metrics, 4 known flaky benchmarks, 4 flaky benchmarks without significant changes.
|
base_stream_handler.py has no LLM Observability dependencies, but it lived under ddtrace/llmobs/_integrations, so every contrib that traces streamed responses (and AI Guard) imported from the LLMObs product. Move it to ddtrace/contrib/internal/stream_handler.py and update all importers. The unit tests are renamed to tests/llmobs/test_stream_handler.py, and the new path is added to the llmobs suitespec component so changes to it keep triggering the LLM integration suites. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
542b999 to
72cb2ae
Compare
|
Pulled out some unrelated test fixes to #20845 |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
LlamaIndex requests bypass their legacy initialization, leaving model/provider metadata unset. Manual Anthropic instrumentation also loses shadow tags and token metrics when LLMObs is disabled.
🤖 Bits Code Review · Commit 28a077b
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 28a077b8a6
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
fix in-flight requests after unpatch()
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bd863312fa
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
This change reduces the coupling between
contrib.anthropicandllmobs. Change summary:LlmRequestEventwithout anllmobs_integration. That field is now optional. The contrib sets theanthropic.request.modeltag itself, through the event's tags.LlmTracingSubscribersends out three new events, defined asLlmEvents:SPAN_STARTING, before the span is created. It's the only point where the span type can still be set to LLM.SPAN_STARTED, right after the span is created.SPAN_FINISHING, just before the span is finished.ddtrace/llmobs/_contrib/anthropic/listen to those events. They ignore events from other integrations, and they callAnthropicIntegration, which they create on first use.listen_integrations()inddtrace/llmobs/_product.pyhooks theanthropic.patchandanthropic.unpatchevents. It runs from the product'spost_preload(ddtrace-run) and fromLLMObs.enable().llama_index, the only other user ofLlmRequestEvent, still passesllmobs_integration=and goes through the old path unchanged.