Skip to content

Commit 86186cb

Browse files
committed
fix add span attr bugs
1 parent 7667127 commit 86186cb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

veadk/tracing/telemetry/telemetry.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,12 @@ def set_common_attributes_on_tool_span(current_span: _Span) -> None:
180180
if span.context.span_id == parent_span_id:
181181
common_attributes = ATTRIBUTES.get("common", {})
182182
for attr_name in common_attributes.keys():
183-
current_span.set_attribute(attr_name, span.attributes[attr_name])
183+
if hasattr(span.attributes, attr_name):
184+
current_span.set_attribute(attr_name, span.attributes[attr_name])
185+
else:
186+
logger.error(
187+
f"Parent span {span.name} does not have attribute {attr_name}"
188+
)
184189

185190

186191
def trace_send_data(): ...

0 commit comments

Comments
 (0)