Skip to content

Commit a0694a7

Browse files
fix: set gen_ai.operation.name for tool spans to "execute_tool"
1 parent d0f1313 commit a0694a7

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

lib/opentelemetry/instrumentation/ruby_llm/patches/chat.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def complete(&)
5858

5959
def execute_tool(tool_call)
6060
attributes = {
61+
"gen_ai.operation.name" => "execute_tool",
6162
"gen_ai.tool.name" => tool_call.name,
6263
"gen_ai.tool.call.id" => tool_call.id,
6364
"gen_ai.tool.call.arguments" => tool_call.arguments.to_json,

test/instrumentation_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ def execute(expression:)
168168
tool_span = tool_spans.first
169169
assert_equal OpenTelemetry::Trace::SpanKind::INTERNAL, tool_span.kind
170170
assert_equal "execute_tool calculator", tool_span.name
171+
assert_equal "execute_tool", tool_span.attributes["gen_ai.operation.name"]
171172
assert_equal "calculator", tool_span.attributes["gen_ai.tool.name"]
172173
assert_equal '{"expression":"2+2"}', tool_span.attributes["gen_ai.tool.call.arguments"]
173174
assert_equal "4", tool_span.attributes["gen_ai.tool.call.result"]

0 commit comments

Comments
 (0)