Skip to content

Commit c57e1bb

Browse files
committed
Simplify attr adding code and remove unnecessary guards.
These are type-checked anyway.
1 parent 99c7ece commit c57e1bb

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

pydantic_ai_slim/pydantic_ai/agent/__init__.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -717,14 +717,11 @@ def _run_span_end_attributes(
717717
attrs['pydantic_ai.variable_instructions'] = True
718718

719719
extra_attributes: dict[str, str] = {}
720-
span_attrs_setting = settings.span_attributes
721-
if span_attrs_setting:
722-
if callable(span_attrs_setting):
723-
resolved_attrs = span_attrs_setting(run_ctx)
724-
if resolved_attrs:
725-
extra_attributes = dict(resolved_attrs)
720+
if settings.span_attributes:
721+
if callable(settings.span_attributes):
722+
extra_attributes = settings.span_attributes(run_ctx)
726723
else:
727-
extra_attributes = dict(span_attrs_setting)
724+
extra_attributes = settings.span_attributes
728725

729726
return {
730727
**usage.opentelemetry_attributes(),

0 commit comments

Comments
 (0)