Skip to content

Commit

Permalink
chore(llmobs): tracer version tagging (#4885)
Browse files Browse the repository at this point in the history
* add tracer version to top-level payload

* fix dd-trace.version to be ddtrace.version tag
  • Loading branch information
sabrenner authored Nov 13, 2024
1 parent 7addced commit 1ce47d2
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/dd-trace/src/llmobs/sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ class LLMObs extends NoopLLMObs {
}

const evaluationTags = {
'dd-trace.version': tracerVersion,
'ddtrace.version': tracerVersion,
ml_app: mlApp
}

Expand Down
2 changes: 1 addition & 1 deletion packages/dd-trace/src/llmobs/span_processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class LLMObsSpanProcessor {
service: this._config.service,
source: 'integration',
ml_app: mlApp,
'dd-trace.version': tracerVersion,
'ddtrace.version': tracerVersion,
error: Number(!!error) || 0,
language: 'javascript'
}
Expand Down
3 changes: 3 additions & 0 deletions packages/dd-trace/src/llmobs/writers/spans/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const { DROPPED_IO_COLLECTION_ERROR } = require('../../constants/tags')
const BaseWriter = require('../base')
const logger = require('../../../log')

const tracerVersion = require('../../../../../../package.json').version

class LLMObsSpanWriter extends BaseWriter {
constructor (options) {
super({
Expand All @@ -32,6 +34,7 @@ class LLMObsSpanWriter extends BaseWriter {
makePayload (events) {
return {
'_dd.stage': 'raw',
'_dd.tracer_version': tracerVersion,
event_type: this._eventType,
spans: events
}
Expand Down
2 changes: 1 addition & 1 deletion packages/dd-trace/test/llmobs/sdk/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ describe('sdk', () => {
label: 'test',
metric_type: 'score',
score_value: 0.6,
tags: [`dd-trace.version:${tracerVersion}`, 'ml_app:test', 'host:localhost']
tags: [`ddtrace.version:${tracerVersion}`, 'ml_app:test', 'host:localhost']
})
})

Expand Down
2 changes: 1 addition & 1 deletion packages/dd-trace/test/llmobs/sdk/integration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ describe('end to end sdk integration tests', () => {
categorical_value: 'bar',
ml_app: 'test',
timestamp_ms: 1234567890,
tags: [`dd-trace.version:${tracerVersion}`, 'ml_app:test']
tags: [`ddtrace.version:${tracerVersion}`, 'ml_app:test']
}
]

Expand Down
2 changes: 1 addition & 1 deletion packages/dd-trace/test/llmobs/span_processor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe('span processor', () => {
'service:',
'source:integration',
'ml_app:myApp',
'dd-trace.version:x.y.z',
'ddtrace.version:x.y.z',
'error:0',
'language:javascript'
],
Expand Down
2 changes: 1 addition & 1 deletion packages/dd-trace/test/llmobs/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ function expectedLLMObsTags ({
`service:${service ?? ''}`,
'source:integration',
`ml_app:${tags.ml_app}`,
`dd-trace.version:${tracerVersion}`
`ddtrace.version:${tracerVersion}`
]

if (sessionId) spanTags.push(`session_id:${sessionId}`)
Expand Down

0 comments on commit 1ce47d2

Please sign in to comment.