Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ddtrace/_trace/_span_pointer.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ def __post_init__(self):
def __repr__(self):
return (
f"SpanPointer(trace_id={self.trace_id}, span_id={self.span_id}, kind={self.kind}, "
f"direction={self.direction}, hash={self.hash}, attributes={self.attributes})"
f"direction={self.attributes.get('ptr.dir')}, hash={self.attributes.get('ptr.hash')}, "
f"attributes={self.attributes})"
)


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fixes:
- |
tracing: Fixes a bug where calling __repr__ on SpanPointer objected raised an AttributeError. This caused aws_lambdas to crash when debug logging was enabled.
7 changes: 5 additions & 2 deletions tests/tracer/test_span.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,7 @@ def test_span_pprint():
root.set_metric("m", 1.0)
root._add_event("message", {"importance": 10}, 16789898242)
root.set_link(trace_id=99, span_id=10, attributes={"link.name": "s1_to_s2", "link.kind": "scheduled_by"})
root._add_span_pointer("test_kind", _SpanPointerDirection.DOWNSTREAM, "test_hash_123", {"extra": "attr"})

root.finish()
actual = root._pprint()
Expand All @@ -867,9 +868,11 @@ def test_span_pprint():
assert "metrics={'m': 1.0}" in actual
assert "events=[SpanEvent(name='message', time=16789898242, attributes={'importance': 10})]" in actual
assert (
"[SpanLink(trace_id=99, span_id=10, attributes={'link.name': 's1_to_s2', 'link.kind': 'scheduled_by'}, "
"tracestate=None, flags=None, dropped_attributes=0)]"
"SpanLink(trace_id=99, span_id=10, attributes={'link.name': 's1_to_s2', 'link.kind': 'scheduled_by'}, "
"tracestate=None, flags=None, dropped_attributes=0)"
) in actual
assert "SpanPointer(trace_id=0, span_id=0, kind=span-pointer" in actual
assert "direction=d, hash=test_hash_123" in actual
assert (
f"context=Context(trace_id={root.trace_id}, span_id={root.span_id}, _meta={{}}, "
"_metrics={}, _span_links=[], _baggage={}, _is_remote=False)"
Expand Down
Loading