Skip to content

fix(llmobs): apply tracer.set_tags() tags to LLM Observability spans - #20681

Open
FouadWahabi wants to merge 2 commits into
mainfrom
fouad.wahabi/llmobs-tracer-set-tags
Open

FouadWahabi wants to merge 2 commits into
mainfrom
fouad.wahabi/llmobs-tracer-set-tags

Conversation

@FouadWahabi

Copy link
Copy Markdown
Contributor

Description

LLM Obs span tags were seeded from config.tags (DD_TAGS only), so tags added with tracer.set_tags() reached APM spans but not LLM Obs spans. Seed from tracer._tags instead, which already includes DD_TAGS.

Testing

Added test_tracer_set_tags_applied_to_llmobs_spans. Also verified end-to-end in staging with a pydantic-ai app.

Risks

LLM Obs spans now also carry tags from tracer.set_tags(), same as APM spans.

LLM Obs span tags were seeded from config.tags, which only holds DD_TAGS.
Tags added later with tracer.set_tags() live in tracer._tags and reached APM
spans but not LLM Obs spans. Seed from tracer._tags, which already includes
DD_TAGS.
@cit-pr-commenter-54b7da

Copy link
Copy Markdown

Codeowners resolved as

Resolved from the full PR diff against main using the target branch CODEOWNERS file.
CODEOWNERS team requests not listed below are not required by the current file set.

ddtrace/llmobs/_llmobs.py                                               @DataDog/ml-observability
releasenotes/notes/llmobs-tracer-set-tags-fae850aeca55cdb5.yaml         @DataDog/apm-python
tests/llmobs/test_llmobs_service.py                                     @DataDog/ml-observability

@cit-pr-commenter-54b7da

Copy link
Copy Markdown

Circular import analysis

⚠️ Existing circular imports

There are 1 circular imports that already exist on the base branch and have not been changed by this PR.

ddtrace.errortracking._handled_exceptions.bytecode_injector -> ddtrace.errortracking._handled_exceptions.callbacks -> ddtrace.errortracking._handled_exceptions.collector -> ddtrace.errortracking._handled_exceptions.bytecode_reporting -> ddtrace.errortracking._handled_exceptions.bytecode_injector

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Dependency direction analysis

⚠️ Existing dependency direction violations

There are 201 dependency direction violations that already exist on the base branch and have not been changed by this PR.

Show existing violations (showing 5 of 201 highest severity)
ddtrace.internal.tracemethods -×-> ddtrace.trace  (internal-core -> product:tracing, score=132)
ddtrace.llmobs._integrations.vertexai -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=130)
ddtrace.internal.test_visibility.api -×-> ddtrace.trace  (product:ci_visibility -> product:tracing, score=130)
ddtrace.llmobs._integrations.google_adk -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=130)
ddtrace.appsec._listeners -×-> ddtrace.trace  (product:appsec -> product:tracing, score=130)

To see all violations, download the layers-base.json and layers-pr.json artifacts from this CI job and run:

uv run --script scripts/import-analysis/layers.py compare layers-base.json layers-pr.json

@FouadWahabi
FouadWahabi marked this pull request as ready for review September 30, 2026 10:10
@FouadWahabi
FouadWahabi requested review from a team as code owners September 30, 2026 10:10
@FouadWahabi
FouadWahabi requested review from sabrenner and removed request for a team September 30, 2026 10:10
@FouadWahabi

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-09-30 20:08:27 UTC ℹ️ Start processing command /merge


2026-09-30 20:08:30 UTC ❌ MergeQueue

The base branch of this pull request is currently frozen (see incident #61179).

If you need to change something else, your pull request can still be merged by commenting /merge -p incident.

@FouadWahabi

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-10-01 12:58:37 UTC ℹ️ Start processing command /merge


2026-10-01 12:58:41 UTC ❌ MergeQueue

The base branch of this pull request is currently frozen (see incident #61179).

If you need to change something else, your pull request can still be merged by commenting /merge -p incident.

@FouadWahabi

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-10-06 21:10:30 UTC ℹ️ Start processing command /merge


2026-10-06 21:10:33 UTC ❌ MergeQueue

The base branch of this pull request is currently frozen (see incident #61179).

If you need to change something else, your pull request can still be merged by commenting /merge -p incident.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-06T21:14:00.474160Z 6a59d12 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants