Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/dd-trace/test/llmobs/tagger.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ describe('tagger', () => {
})

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

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

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

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

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

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

tagger.registerLLMObsSpan(span, { kind: 'llm' })
Expand Down
Loading