fix(llmobs): prevent config origin overwrite in enable()#7183
Conversation
The enable() method was spreading the entire config object when calling configure(), which incorrectly reset all config values with origin 'code', overwriting their actual origins (e.g. 'env', 'default'). This affects telemetry tracking of config origins. - Pass only llmobs config to configure() to avoid overwriting origins - Remove unnecessary intermediate variables - Invert early-return logic for clearer control flow - Add TODO comment about config telemetry origin tracking
Overall package sizeSelf size: 4.39 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 2.0.0 | 68.46 kB | 797.03 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
BenchmarksBenchmark execution time: 2026-01-06 21:09:53 Comparing candidate commit 8baa329 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 293 metrics, 27 unstable metrics. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7183 +/- ##
==========================================
+ Coverage 84.51% 84.52% +0.01%
==========================================
Files 525 525
Lines 22492 22488 -4
==========================================
- Hits 19008 19007 -1
+ Misses 3484 3481 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
sabrenner
left a comment
There was a problem hiding this comment.
thanks for catching this! tbh the code in sdk for this enablement is from a misguided early on approach of mirroring our Python implementation, which does need an enable method to call as it is its own module, but totally not needed here, and in our docs we only ever show enablement through init.
The idea is in v6 we'll remove these methods (reminds me that I need to add a deprecation log), so hopefully this just won't be an issue at that point, but again thank you for catching this in the meantime!
also thanks for the minor cleanups, definitely makes sense 😄
BridgeAR
left a comment
There was a problem hiding this comment.
While this already improves things very slightly, it does not seem to fix the overall issue that config things should not be handled outside of config.
The enable() method was spreading the entire config object when calling configure(), which incorrectly reset all config values with origin 'code', overwriting their actual origins (e.g. 'env', 'default'). This affects telemetry tracking of config origins. - Pass only llmobs config to configure() to avoid overwriting origins - Remove unnecessary intermediate variables - Invert early-return logic for clearer control flow - Add TODO comment about config telemetry origin tracking
The enable() method was spreading the entire config object when calling configure(), which incorrectly reset all config values with origin 'code', overwriting their actual origins (e.g. 'env', 'default'). This affects telemetry tracking of config origins. - Pass only llmobs config to configure() to avoid overwriting origins - Remove unnecessary intermediate variables - Invert early-return logic for clearer control flow - Add TODO comment about config telemetry origin tracking

What does this PR do?
Fixes a bug in the LLMObs SDK's
enable()method where configuration origins were being incorrectly tracked for telemetry:llmobsconfig object toconfigure()to avoid spreading the entire configconfig.jsandsdk.jssdk.jsfor clearer control flowconfigure()fromenable()still sets origin as'code'even whenenable()is called from Remote Config updatesMotivation
The
enable()method inpackages/dd-trace/src/llmobs/sdk.jswas spreading the entire_configobject when callingconfigure():This caused all configuration values to be re-set with origin
'code', overwriting their actual origins (e.g.'env','default', etc.). This breaks telemetry tracking which relies on accurate origin information to understand how users are configuring the tracer.Additional Notes
I've done my best to ensure that it's ok to call
configurewith only a sub-set of config options and that it will still work even if#applyOptionswas called previously with another sub-set of options. But this is important to review!There's still a remaining issue (noted in the TODO): when
enable()is called based onAPM_TRACINGRC product updates, the config telemetry will show origin as'code'rather than the actual source (whatever that should actually be?).