Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Do not record `gen_ai.provider.name` on tool execution metric attributes.
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@
FunctionSpanData,
)

from opentelemetry.semconv._incubating.attributes import (
gen_ai_attributes as GenAI,
)
from opentelemetry.semconv._incubating.attributes.error_attributes import (
ErrorTypeValues,
)
Expand Down Expand Up @@ -117,13 +114,6 @@ def on_span_start(self, span: Span[Any]) -> None:
name=span_data.name,
tool_type="function",
)

# ToolInvocation does not include provider in metric attributes
# by default; set it so gen_ai.client.operation.duration carries
# the required gen_ai.provider.name attribute.
invocation.metric_attributes[GenAI.GEN_AI_PROVIDER_NAME] = (
self._provider
)
self._invocations[span] = invocation
return
# Other span_data types (GenerationSpanData, ResponseSpanData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ def test_agent_span_creates_invoke_local_agent() -> None:
handler.invoke_local_agent.return_value.stop.assert_called_once_with()


def test_function_span_creates_tool_invocation_and_sets_provider_metric() -> (
None
):
def test_function_span_creates_tool_invocation() -> None:
handler = _build_handler()
handler.tool.return_value = MagicMock(
spec=ToolInvocation,
Expand All @@ -109,10 +107,6 @@ def test_function_span_creates_tool_invocation_and_sets_provider_metric() -> (
)
tool_invocation = handler.tool.return_value
Comment thread
lmolkova marked this conversation as resolved.

assert (
tool_invocation.metric_attributes["gen_ai.provider.name"] == "openai"
)

# Input and output both get populated on the agents library span_data
# while the tool runs, i.e. after on_span_start; our on_span_end reads
# them.
Expand Down
Loading