Skip to content

Commit 0672b4d

Browse files
authored
fix tag merging logic to update (#5705)
1 parent 6080e49 commit 0672b4d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/dd-trace/src/llmobs/tagger.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ class LLMObsTagger {
148148
}
149149

150150
tagSpanTags (span, tags) {
151-
// new tags will be merged with existing tags
152151
const currentTags = registry.get(span)?.[TAGS]
153152
if (currentTags) {
154-
Object.assign(tags, currentTags)
153+
Object.assign(currentTags, tags)
154+
} else {
155+
this._setTag(span, TAGS, tags)
155156
}
156-
this._setTag(span, TAGS, tags)
157157
}
158158

159159
changeKind (span, newKind) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,12 +230,12 @@ describe('tagger', () => {
230230
})
231231
})
232232

233-
it('merges tags so they do not overwrite', () => {
233+
it('merges tags so they update', () => {
234234
Tagger.tagMap.set(span, { '_ml_obs.tags': { a: 1 } })
235235
const tags = { a: 2, b: 1 }
236236
tagger.tagSpanTags(span, tags)
237237
expect(Tagger.tagMap.get(span)).to.deep.equal({
238-
'_ml_obs.tags': { a: 1, b: 1 }
238+
'_ml_obs.tags': { a: 2, b: 1 }
239239
})
240240
})
241241
})

0 commit comments

Comments
 (0)