Skip to content

Commit e1ca809

Browse files
authored
chore: update span names (#440)
1 parent 30fb562 commit e1ca809

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/strands/telemetry/tracer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def start_model_invoke_span(
235235
# Add additional kwargs as attributes
236236
attributes.update({k: v for k, v in kwargs.items() if isinstance(v, (str, int, float, bool))})
237237

238-
span = self._start_span("Model invoke", parent_span, attributes, span_kind=trace_api.SpanKind.CLIENT)
238+
span = self._start_span("chat", parent_span, attributes, span_kind=trace_api.SpanKind.CLIENT)
239239
for message in messages:
240240
self._add_event(
241241
span,
@@ -371,7 +371,7 @@ def start_event_loop_cycle_span(
371371
# Add additional kwargs as attributes
372372
attributes.update({k: v for k, v in kwargs.items() if isinstance(v, (str, int, float, bool))})
373373

374-
span_name = f"Cycle {event_loop_cycle_id}"
374+
span_name = "execute_event_loop_cycle"
375375
span = self._start_span(span_name, parent_span, attributes)
376376
for message in messages or []:
377377
self._add_event(

tests/strands/telemetry/test_tracer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def test_start_model_invoke_span(mock_tracer):
151151
span = tracer.start_model_invoke_span(messages=messages, agent_name="TestAgent", model_id=model_id)
152152

153153
mock_tracer.start_span.assert_called_once()
154-
assert mock_tracer.start_span.call_args[1]["name"] == "Model invoke"
154+
assert mock_tracer.start_span.call_args[1]["name"] == "chat"
155155
assert mock_tracer.start_span.call_args[1]["kind"] == SpanKind.CLIENT
156156
mock_span.set_attribute.assert_any_call("gen_ai.system", "strands-agents")
157157
mock_span.set_attribute.assert_any_call("gen_ai.operation.name", "chat")
@@ -240,7 +240,7 @@ def test_start_event_loop_cycle_span(mock_tracer):
240240
span = tracer.start_event_loop_cycle_span(event_loop_kwargs, messages=messages)
241241

242242
mock_tracer.start_span.assert_called_once()
243-
assert mock_tracer.start_span.call_args[1]["name"] == "Cycle cycle-123"
243+
assert mock_tracer.start_span.call_args[1]["name"] == "execute_event_loop_cycle"
244244
mock_span.set_attribute.assert_any_call("event_loop.cycle_id", "cycle-123")
245245
mock_span.add_event.assert_any_call(
246246
"gen_ai.user.message", attributes={"content": json.dumps([{"text": "Hello"}])}

0 commit comments

Comments
 (0)