Skip to content

fix(llmobs): make sure correct llmobs trace id is returned from export_span [backport 3.9] #13622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2025

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Jun 6, 2025

Backport f5bed1c from #13620 to 3.9.

We recently changed how we record our LLMObs trace IDs - from APM trace IDs to new randomly generated ones. However, we missed updating export_span. This PR ensures we export the correct trace ID from export_span.

Checklist

  • PR author has checked that all the criteria below are met
  • The PR description includes an overview of the change
  • The PR description articulates the motivation for the change
  • The change includes tests OR the PR description describes a testing strategy
  • The PR description notes risks associated with the change, if any
  • Newly-added code is easy to change
  • The change follows the library release note guidelines
  • The change includes or references documentation updates if necessary
  • Backport labels are set (if applicable)

Reviewer Checklist

  • Reviewer has checked that all the criteria below are met
  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Newly-added code is easy to change
  • Release note makes sense to a user of the library
  • If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment
  • Backport labels are set in a manner that is consistent with the release branch maintenance policy

…rt_span` (#13620)

We recently changed how we record our LLMObs trace IDs - from APM trace
IDs to new randomly generated ones. However, we missed updating
`export_span`. This PR ensures we export the correct trace ID from
`export_span`.

## Checklist
- [x] PR author has checked that all the criteria below are met
- The PR description includes an overview of the change
- The PR description articulates the motivation for the change
- The change includes tests OR the PR description describes a testing
strategy
- The PR description notes risks associated with the change, if any
- Newly-added code is easy to change
- The change follows the [library release note
guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
- The change includes or references documentation updates if necessary
- Backport labels are set (if
[applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting))

## Reviewer Checklist
- [x] Reviewer has checked that all the criteria below are met
- Title is accurate
- All changes are related to the pull request's stated goal
- Avoids breaking
[API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
changes
- Testing strategy adequately addresses listed risks
- Newly-added code is easy to change
- Release note makes sense to a user of the library
- If necessary, author has acknowledged and discussed the performance
implications of this PR as reported in the benchmarks PR comment
- Backport labels are set in a manner that is consistent with the
[release branch maintenance
policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)

(cherry picked from commit f5bed1c)
@github-actions github-actions bot requested review from a team as code owners June 6, 2025 20:35
@github-actions github-actions bot requested review from tabgok and duncanista June 6, 2025 20:35
@brettlangdon brettlangdon reopened this Jun 6, 2025
Copy link
Contributor Author

github-actions bot commented Jun 6, 2025

CODEOWNERS have been resolved as:

releasenotes/notes/llmobs-fix-incorrect-exported-trace-id-d35aeea97a8419c4.yaml  @DataDog/apm-python
ddtrace/llmobs/_llmobs.py                                               @DataDog/ml-observability
tests/llmobs/test_llmobs_service.py                                     @DataDog/ml-observability

@brettlangdon brettlangdon enabled auto-merge (squash) June 6, 2025 21:02
Copy link
Contributor Author

github-actions bot commented Jun 6, 2025

Bootstrap import analysis

Comparison of import times between this PR and base.

Summary

The average import time from this PR is: 282 ± 4 ms.

The average import time from base is: 285 ± 4 ms.

The import time difference between this PR and base is: -3.1 ± 0.2 ms.

Import time breakdown

The following import paths have shrunk:

ddtrace.auto 2.064 ms (0.73%)
ddtrace.bootstrap.sitecustomize 1.384 ms (0.49%)
ddtrace.bootstrap.preload 1.384 ms (0.49%)
ddtrace.internal.remoteconfig.client 0.670 ms (0.24%)
ddtrace 0.681 ms (0.24%)
ddtrace.internal._unpatched 0.024 ms (0.01%)

@pr-commenter
Copy link

pr-commenter bot commented Jun 6, 2025

Benchmarks

Benchmark execution time: 2025-06-06 21:49:55

Comparing candidate commit 0735889 in PR branch backport-13620-to-3.9 with baseline commit eff5773 in branch 3.9.

Found 0 performance improvements and 4 performance regressions! Performance is the same for 549 metrics, 3 unstable metrics.

scenario:iastaspects-format_map_aspect

  • 🟥 execution_time [+295.438ns; +414.568ns] or [+9.092%; +12.759%]

scenario:iastaspects-upper_aspect

  • 🟥 execution_time [+200.165ns; +233.588ns] or [+8.812%; +10.283%]

scenario:iastaspectsospath-ospathjoin_aspect

  • 🟥 execution_time [+887.862ns; +968.985ns] or [+14.458%; +15.779%]

scenario:telemetryaddmetric-flush-1-metric

  • 🟥 execution_time [+320.141ns; +488.793ns] or [+7.627%; +11.645%]

@brettlangdon brettlangdon merged commit faa79f4 into 3.9 Jun 6, 2025
419 of 421 checks passed
@brettlangdon brettlangdon deleted the backport-13620-to-3.9 branch June 6, 2025 21:51
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.

3 participants