Skip to content

Commit 1734709

Browse files
committed
Fix operation name of llm span
Change-Id: I4a6f48d0f66b8ad00a6ce4be8dcf4a46aba68e33 Co-developed-by: Cursor <[email protected]>
1 parent 20b740c commit 1734709

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

util/opentelemetry-util-genai/src/opentelemetry/util/genai/span_utils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ def _get_llm_common_attributes(
5454
Returns a dictionary of attributes.
5555
"""
5656
attributes: dict[str, Any] = {}
57-
attributes[GenAI.GEN_AI_OPERATION_NAME] = (
58-
GenAI.GenAiOperationNameValues.CHAT.value
59-
)
57+
attributes[GenAI.GEN_AI_OPERATION_NAME] = invocation.operation_name
6058
if invocation.request_model:
6159
attributes[GenAI.GEN_AI_REQUEST_MODEL] = invocation.request_model
6260
if invocation.provider is not None:

util/opentelemetry-util-genai/src/opentelemetry/util/genai/types.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@
2222
from typing_extensions import TypeAlias
2323

2424
from opentelemetry.context import Context
25-
from opentelemetry.trace import Span
26-
2725
from opentelemetry.semconv._incubating.attributes import (
2826
gen_ai_attributes as GenAI,
2927
)
28+
from opentelemetry.trace import Span
3029

3130
ContextToken: TypeAlias = Token[Context]
3231

0 commit comments

Comments
 (0)