Skip to content

Commit 18aa29c

Browse files
committed
test(llmobs): use DD_LLMOBS_ENABLED in tagger sampling fixtures (#9107)
The sampling tests in #9030 build their own taggers with `{ llmobs: { enabled: true } }`, and #8943 renamed that config key to `DD_LLMOBS_ENABLED` everywhere it could see. The two landed in parallel, so #8943 normalized the rest of the file but never saw these four fixtures. On master the tagger now reads `DD_LLMOBS_ENABLED`, finds it undefined, and returns before registering the span; `Tagger.tagMap.get` then yields undefined and the "DROPPED at sampleRate 0" test throws synchronously, aborting the whole `test:llmobs:sdk:ci` run with exit 7. Fixes: https://github.com/DataDog/dd-trace-js/actions/runs/28265509637/job/83751636644
1 parent 9f47329 commit 18aa29c

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

packages/dd-trace/test/llmobs/tagger.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ describe('tagger', () => {
196196
})
197197

198198
it('records a DROPPED decision on a root span when sampleRate is 0', () => {
199-
tagger = new Tagger({ llmobs: { enabled: true, mlApp: 'my-default-ml-app', sampleRate: 0 } })
199+
tagger = new Tagger({ llmobs: { DD_LLMOBS_ENABLED: true, mlApp: 'my-default-ml-app', sampleRate: 0 } })
200200
tagger.registerLLMObsSpan(span, { kind: 'llm' })
201201

202202
const tags = Tagger.tagMap.get(span)
@@ -206,15 +206,15 @@ describe('tagger', () => {
206206

207207
it('truncates a longer rate to at most 6 decimals', () => {
208208
// 1/3 = 0.3333... which must be capped at 6 decimal places.
209-
tagger = new Tagger({ llmobs: { enabled: true, mlApp: 'my-default-ml-app', sampleRate: 1 / 3 } })
209+
tagger = new Tagger({ llmobs: { DD_LLMOBS_ENABLED: true, mlApp: 'my-default-ml-app', sampleRate: 1 / 3 } })
210210
tagger.registerLLMObsSpan(span, { kind: 'llm' })
211211

212212
assert.strictEqual(Tagger.tagMap.get(span)['_ml_obs.sample_rate'], '0.333333')
213213
})
214214

215215
it('strips trailing zeros from a fractional rate', () => {
216216
// 0.25 -> "0.250000" via toFixed(6), which must be stripped back to "0.25".
217-
tagger = new Tagger({ llmobs: { enabled: true, mlApp: 'my-default-ml-app', sampleRate: 0.25 } })
217+
tagger = new Tagger({ llmobs: { DD_LLMOBS_ENABLED: true, mlApp: 'my-default-ml-app', sampleRate: 0.25 } })
218218
tagger.registerLLMObsSpan(span, { kind: 'llm' })
219219

220220
assert.strictEqual(Tagger.tagMap.get(span)['_ml_obs.sample_rate'], '0.25')
@@ -253,7 +253,7 @@ describe('tagger', () => {
253253
// The tagger reads sampleRate from config on each root decision, so a
254254
// mutation (such as a future remote config update) takes effect without
255255
// re-instantiating the tagger.
256-
const config = { llmobs: { enabled: true, mlApp: 'my-default-ml-app', sampleRate: 1 } }
256+
const config = { llmobs: { DD_LLMOBS_ENABLED: true, mlApp: 'my-default-ml-app', sampleRate: 1 } }
257257
tagger = new Tagger(config)
258258

259259
tagger.registerLLMObsSpan(span, { kind: 'llm' })

0 commit comments

Comments
 (0)