diff --git a/ddtrace/llmobs/_trace_processor.py b/ddtrace/llmobs/_trace_processor.py index b122ad11396..3c6b31bbc10 100644 --- a/ddtrace/llmobs/_trace_processor.py +++ b/ddtrace/llmobs/_trace_processor.py @@ -65,8 +65,9 @@ def _llmobs_span_event(self, span: Span) -> Dict[str, Any]: if span.get_tag(OUTPUT_VALUE): meta["output"]["value"] = span._meta.pop(OUTPUT_VALUE) if span.error: - meta["error.message"] = span.get_tag(ERROR_MSG) - meta["error.stack"] = span.get_tag(ERROR_STACK) + meta[ERROR_MSG] = span.get_tag(ERROR_MSG) + meta[ERROR_STACK] = span.get_tag(ERROR_STACK) + meta[ERROR_TYPE] = span.get_tag(ERROR_TYPE) if not meta["input"]: meta.pop("input") if not meta["output"]: diff --git a/tests/llmobs/_utils.py b/tests/llmobs/_utils.py index 99f6d269801..994e1a9d1da 100644 --- a/tests/llmobs/_utils.py +++ b/tests/llmobs/_utils.py @@ -157,6 +157,7 @@ def _llmobs_base_span_event( "metrics": {}, } if error: + span_event["meta"]["error.type"] = error span_event["meta"]["error.message"] = error_message span_event["meta"]["error.stack"] = error_stack return span_event