Skip to content

Commit 96bf1b5

Browse files
committed
fix(telemetry): make strands agent invoke_agent and chat span as INTERNAL spanKind
1 parent c123f09 commit 96bf1b5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/strands/telemetry/tracer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def start_model_invoke_span(
293293
# Add additional kwargs as attributes
294294
attributes.update({k: v for k, v in kwargs.items() if isinstance(v, (str, int, float, bool))})
295295

296-
span = self._start_span("chat", parent_span, attributes=attributes, span_kind=trace_api.SpanKind.CLIENT)
296+
span = self._start_span("chat", parent_span, attributes=attributes, span_kind=trace_api.SpanKind.INTERNAL)
297297
self._add_event_messages(span, messages)
298298

299299
return span

tests/strands/telemetry/test_tracer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def test_start_model_invoke_span(mock_tracer):
153153

154154
mock_tracer.start_span.assert_called_once()
155155
assert mock_tracer.start_span.call_args[1]["name"] == "chat"
156-
assert mock_tracer.start_span.call_args[1]["kind"] == SpanKind.CLIENT
156+
assert mock_tracer.start_span.call_args[1]["kind"] == SpanKind.INTERNAL
157157
mock_span.set_attribute.assert_any_call("gen_ai.system", "strands-agents")
158158
mock_span.set_attribute.assert_any_call("gen_ai.operation.name", "chat")
159159
mock_span.set_attribute.assert_any_call("gen_ai.request.model", model_id)
@@ -188,7 +188,7 @@ def test_start_model_invoke_span_latest_conventions(mock_tracer):
188188

189189
mock_tracer.start_span.assert_called_once()
190190
assert mock_tracer.start_span.call_args[1]["name"] == "chat"
191-
assert mock_tracer.start_span.call_args[1]["kind"] == SpanKind.CLIENT
191+
assert mock_tracer.start_span.call_args[1]["kind"] == SpanKind.INTERNAL
192192
mock_span.set_attribute.assert_any_call("gen_ai.provider.name", "strands-agents")
193193
mock_span.set_attribute.assert_any_call("gen_ai.operation.name", "chat")
194194
mock_span.set_attribute.assert_any_call("gen_ai.request.model", model_id)

0 commit comments

Comments
 (0)