From 9a428d9e6dd1f740c26e4bd9aa1a6a01eea38ac3 Mon Sep 17 00:00:00 2001 From: Sam Brenner <106700075+sabrenner@users.noreply.github.com> Date: Wed, 18 Sep 2024 08:48:28 -0400 Subject: [PATCH] chore(llmobs): add language tag to span events (#10681) Adds a `language:python` tag to all LLMObs span events, to be used for internal analysis. No changelog needed since this isn't a user-facing functional change or fix (it will just show as an extra tag in the UI). (cherry picked from commit b488c99d2b8a76e637ef46079e20e7a21e0748a1) --- ddtrace/llmobs/_trace_processor.py | 1 + tests/llmobs/_utils.py | 1 + 2 files changed, 2 insertions(+) diff --git a/ddtrace/llmobs/_trace_processor.py b/ddtrace/llmobs/_trace_processor.py index 7c2e4608567..561513c52f4 100644 --- a/ddtrace/llmobs/_trace_processor.py +++ b/ddtrace/llmobs/_trace_processor.py @@ -127,6 +127,7 @@ def _llmobs_tags(span: Span, ml_app: str, session_id: str) -> List[str]: "ml_app": ml_app, "session_id": session_id, "ddtrace.version": ddtrace.__version__, + "language": "python", "error": span.error, } err_type = span.get_tag(ERROR_TYPE) diff --git a/tests/llmobs/_utils.py b/tests/llmobs/_utils.py index 1e3520b8d77..6f1e8db4971 100644 --- a/tests/llmobs/_utils.py +++ b/tests/llmobs/_utils.py @@ -28,6 +28,7 @@ def _expected_llmobs_tags(span, error=None, tags=None, session_id=None): "ml_app:{}".format(tags.get("ml_app", "unnamed-ml-app")), "session_id:{}".format(session_id or "{:x}".format(span.trace_id)), "ddtrace.version:{}".format(ddtrace.__version__), + "language:python", ] if error: expected_tags.append("error:1")