From 20a3ada916aa1acf43ee57d720b0fccf11ab3baf Mon Sep 17 00:00:00 2001 From: Mark Backman Date: Fri, 20 Mar 2026 13:20:03 -0400 Subject: [PATCH] refactor: rename tracing span attribute "system" to "system_instructions" Align with the OpenTelemetry GenAI semantic convention gen_ai.system_instructions for system prompts. The old "system" attribute name was unrelated to gen_ai.system (which is for provider name). --- changelog/3449.changed.md | 1 + src/pipecat/utils/tracing/service_attributes.py | 8 ++++---- src/pipecat/utils/tracing/service_decorators.py | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 changelog/3449.changed.md diff --git a/changelog/3449.changed.md b/changelog/3449.changed.md new file mode 100644 index 000000000..d06ad37c4 --- /dev/null +++ b/changelog/3449.changed.md @@ -0,0 +1 @@ +- Renamed tracing span attribute `system` to `system_instructions` to align with the OpenTelemetry GenAI semantic conventions. diff --git a/src/pipecat/utils/tracing/service_attributes.py b/src/pipecat/utils/tracing/service_attributes.py index 21a22341f..1a6537f2b 100644 --- a/src/pipecat/utils/tracing/service_attributes.py +++ b/src/pipecat/utils/tracing/service_attributes.py @@ -193,7 +193,7 @@ def add_llm_span_attributes( tools: Optional[str] = None, tool_count: Optional[int] = None, tool_choice: Optional[str] = None, - system: Optional[str] = None, + system_instructions: Optional[str] = None, parameters: Optional[Dict[str, Any]] = None, extra_parameters: Optional[Dict[str, Any]] = None, ttfb: Optional[float] = None, @@ -211,7 +211,7 @@ def add_llm_span_attributes( tools: JSON-serialized tools configuration. tool_count: Number of tools available. tool_choice: Tool selection configuration. - system: System message. + system_instructions: System instructions. parameters: Service parameters. extra_parameters: Additional parameters. ttfb: Time to first byte in seconds. @@ -240,8 +240,8 @@ def add_llm_span_attributes( if tool_choice: span.set_attribute("tool_choice", tool_choice) - if system: - span.set_attribute("system", system) + if system_instructions: + span.set_attribute("system_instructions", system_instructions) if ttfb is not None: span.set_attribute("metrics.ttfb", ttfb) diff --git a/src/pipecat/utils/tracing/service_decorators.py b/src/pipecat/utils/tracing/service_decorators.py index 2b189feb5..2e54732f1 100644 --- a/src/pipecat/utils/tracing/service_decorators.py +++ b/src/pipecat/utils/tracing/service_decorators.py @@ -538,7 +538,7 @@ def traced_llm(func: Optional[Callable] = None, *, name: Optional[str] = None) - if hasattr(self, "_settings"): for key, value in self._settings.given_fields().items(): # system_instruction is already captured as the - # "system" span attribute above. + # "system_instructions" span attribute above. if key == "system_instruction": continue if isinstance(value, (int, float, bool, str)): @@ -561,7 +561,7 @@ def traced_llm(func: Optional[Callable] = None, *, name: Optional[str] = None) - attribute_kwargs["tools"] = serialized_tools attribute_kwargs["tool_count"] = tool_count if system_message: - attribute_kwargs["system"] = system_message + attribute_kwargs["system_instructions"] = system_message # Add all gathered attributes to the span add_llm_span_attributes(span=current_span, **attribute_kwargs)