Skip to content

Conversation

@jsimpher
Copy link
Contributor

@jsimpher jsimpher commented May 20, 2025

https://docs.google.com/document/d/1ZkKRU0JfljPiwLH1mXaAYRpFaEMFpRGKc5axOjo8mjo/edit?tab=t.0
The goal here is to separate the concept of an llmobs trace id from that of an apm trace id, which will have value in trace level insights, as well as resolving some ui issues around multiple llmobs traces sharing a single trace id.
This is accomplished by adding an llmobs trace id tag to the span, passing it down from parent to child, and ultimately using it instead of trace_id to fill the llmobs_span['trace_id'] slot. the original apm trace id now to be stored in ._dd.apm_trace_id.
QA kind of important here, relatively high blast radius, could ruin trace grouping/heirarchy

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

@jsimpher jsimpher changed the title Jsimpher/tli add apm trace tli add apm trace May 20, 2025
@github-actions
Copy link
Contributor

github-actions bot commented May 28, 2025

CODEOWNERS have been resolved as:

ddtrace/llmobs/_constants.py                                            @DataDog/ml-observability
ddtrace/llmobs/_llmobs.py                                               @DataDog/ml-observability
tests/llmobs/_utils.py                                                  @DataDog/ml-observability
tests/llmobs/test_llmobs.py                                             @DataDog/ml-observability
tests/llmobs/test_llmobs_service.py                                     @DataDog/ml-observability
tests/llmobs/test_propagation.py                                        @DataDog/ml-observability

@jsimpher jsimpher force-pushed the jsimpher/tli-add-apm-trace-id branch from 75a965a to af97999 Compare May 28, 2025 20:56
@jsimpher jsimpher changed the title tli add apm trace [MLOB-2709] tli add apm trace May 28, 2025
@jsimpher jsimpher changed the title [MLOB-2709] tli add apm trace chore(llmobs): tli add apm trace May 28, 2025
@github-actions
Copy link
Contributor

github-actions bot commented May 28, 2025

Bootstrap import analysis

Comparison of import times between this PR and base.

Summary

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

The average import time from base is: 242 ± 2 ms.

The import time difference between this PR and base is: 3.3 ± 0.1 ms.

Import time breakdown

The following import paths have grown:

ddtrace.auto 0.698 ms (0.28%)
ddtrace 0.478 ms (0.19%)
ddtrace._logger 0.389 ms (0.16%)
ddtrace.internal.telemetry 0.389 ms (0.16%)
ddtrace.internal.telemetry.writer 0.195 ms (0.08%)
http.client 0.169 ms (0.07%)
email.parser 0.096 ms (0.04%)
email.feedparser 0.096 ms (0.04%)
email._policybase 0.096 ms (0.04%)
email.utils 0.096 ms (0.04%)
datetime 0.096 ms (0.04%)
_datetime 0.096 ms (0.04%)
ssl 0.073 ms (0.03%)
ddtrace.internal.runtime 0.026 ms (0.01%)
uuid 0.026 ms (0.01%)
ddtrace.settings._agent 0.194 ms (0.08%)
ddtrace.settings 0.194 ms (0.08%)
ddtrace.settings.http 0.168 ms (0.07%)
ddtrace.internal.utils.http 0.114 ms (0.05%)
email.encoders 0.114 ms (0.05%)
base64 0.114 ms (0.05%)
ddtrace.internal.utils.cache 0.054 ms (0.02%)
inspect 0.054 ms (0.02%)
ddtrace.settings.integration 0.026 ms (0.01%)
ddtrace.vendor.debtcollector 0.026 ms (0.01%)
ddtrace.vendor.debtcollector.moves 0.026 ms (0.01%)
wrapt 0.026 ms (0.01%)
wrapt.__wrapt__ 0.026 ms (0.01%)
wrapt.wrappers 0.026 ms (0.01%)
ddtrace.trace 0.050 ms (0.02%)
ddtrace._monkey 0.039 ms (0.02%)
ddtrace.appsec._listeners 0.039 ms (0.02%)
ddtrace.internal.core 0.039 ms (0.02%)
ddtrace.internal.core.event_hub 0.039 ms (0.02%)
ddtrace.bootstrap.sitecustomize 0.220 ms (0.09%)
ddtrace.bootstrap.preload 0.220 ms (0.09%)
ddtrace.internal.products 0.163 ms (0.07%)
importlib.metadata 0.163 ms (0.07%)
importlib.abc 0.107 ms (0.04%)
importlib.resources 0.107 ms (0.04%)
importlib.resources._common 0.107 ms (0.04%)
ddtrace.internal.remoteconfig._connectors 0.029 ms (0.01%)
ctypes 0.029 ms (0.01%)
_ctypes 0.029 ms (0.01%)
ddtrace.internal.remoteconfig.worker 0.028 ms (0.01%)

The following import paths have shrunk:

ddtrace.auto 1.180 ms (0.48%)
ddtrace 0.643 ms (0.26%)
ddtrace.bootstrap.sitecustomize 0.537 ms (0.22%)
ddtrace.bootstrap.preload 0.537 ms (0.22%)
ddtrace.internal.remoteconfig.client 0.537 ms (0.22%)

@pr-commenter
Copy link

pr-commenter bot commented May 28, 2025

Benchmarks

Benchmark execution time: 2025-05-30 21:51:06

Comparing candidate commit 8acddb0 in PR branch jsimpher/tli-add-apm-trace-id with baseline commit 7477e5f in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 503 metrics, 5 unstable metrics.

@jsimpher
Copy link
Contributor Author

jsimpher commented May 29, 2025

first time really playing with sdk so would also appreciate guidance on best practices/any additional tests. nervous ill break somethings so any qa approaches i wouldn't think of please let me know

@jsimpher jsimpher marked this pull request as ready for review May 29, 2025 13:30
@jsimpher jsimpher requested a review from a team as a code owner May 29, 2025 13:30
@jsimpher jsimpher added the changelog/no-changelog A changelog entry is not required for this PR. label May 29, 2025
Copy link
Contributor

@yshapiro-57 yshapiro-57 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have taken a look at this PR and left comments, feel free to address only those that make sense to you, @jsimpher.

I am doing a low-level line-by-line review here, probably similar to what Cursor would have done. I don't have a clear picture in my head of how different components of this code fit together; for example, if there was a file that was supposed to be changed but was not, I am not going to catch that in my review. So if you are able to please take a look at well, @sabrenner, I will really appreciate it.

Copy link
Contributor

@yshapiro-57 yshapiro-57 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me re-approve this now to indicate that my comments have all been addressed. You may want to take a look at the CI errors while we wait for Sam to give this a look as well.

Copy link
Contributor

@sabrenner sabrenner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great!! just doing some manual QAing and might add some other cleanup comments after but i think the approach is solid 😎

Copy link
Contributor

@sabrenner sabrenner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finishing up QAing but did a quick style pass again, just a couple thoughts

@emmettbutler emmettbutler self-requested a review May 30, 2025 20:47
@jsimpher jsimpher merged commit 1605451 into main May 30, 2025
351 of 352 checks passed
@jsimpher jsimpher deleted the jsimpher/tli-add-apm-trace-id branch May 30, 2025 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/no-changelog A changelog entry is not required for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants