Skip to content

Commit

Permalink
update error logic
Browse files Browse the repository at this point in the history
  • Loading branch information
sabrenner committed Oct 8, 2024
1 parent bdf5fc0 commit c2408d0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/dd-trace/src/llmobs/span_processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class LLMObsSpanProcessor {
output.documents = mlObsTags[OUTPUT_DOCUMENTS]
}

const error = spanTags.error
const error = spanTags.error || spanTags[ERROR_TYPE]
if (error) {
meta[ERROR_MESSAGE] = spanTags[ERROR_MESSAGE] || error.message || error.code
meta[ERROR_TYPE] = spanTags[ERROR_TYPE] || error.name
Expand All @@ -126,7 +126,7 @@ class LLMObsSpanProcessor {
tags: this._processTags(span, mlApp, sessionId, error),
start_ns: Math.round(span._startTime * 1e6),
duration: Math.round(span._duration * 1e6),
status: spanTags.error ? 'error' : 'ok',
status: error ? 'error' : 'ok',
meta,
metrics,
_dd: {
Expand Down
1 change: 0 additions & 1 deletion packages/dd-trace/test/llmobs/span_processor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ describe('span processor', () => {
context () {
return {
_tags: {
error: new Error(),
'error.message': 'error message',
'error.type': 'error type',
'error.stack': 'error stack'
Expand Down

0 comments on commit c2408d0

Please sign in to comment.