Skip to content
This repository was archived by the owner on Mar 4, 2026. It is now read-only.

Commit 99aaadb

Browse files
committed
add logging
1 parent 5e12071 commit 99aaadb

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/uipath/core/tracing/manager.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,33 +66,48 @@ def _get_bottom_most_span(current_span: Any, external_span: Any) -> Any:
6666
The span that is deeper (closer to the bottom) in the call hierarchy
6767
"""
6868
ancestor_spans = UiPathTracingManager.get_ancestor_spans()
69+
70+
logger.debug(f"ancestor_spans length: {len(ancestor_spans) if ancestor_spans else 0}")
71+
6972
if not ancestor_spans:
73+
logger.debug("No ancestor spans, returning external_span")
7074
return external_span
7175

7276
current_span_id = current_span.get_span_context().span_id
7377
external_span_id = external_span.get_span_context().span_id
7478

79+
logger.debug(f"current_span_id: {current_span_id}")
80+
logger.debug(f"external_span_id: {external_span_id}")
81+
7582
current_index = None
7683
external_index = None
7784

7885
for i, ancestor in enumerate(ancestor_spans):
7986
ancestor_id = ancestor.get_span_context().span_id
87+
logger.debug(f"ancestor[{i}] id: {ancestor_id}")
8088
if ancestor_id == current_span_id:
8189
current_index = i
8290
if ancestor_id == external_span_id:
8391
external_index = i
8492

93+
logger.debug(f"current_index: {current_index}, external_index: {external_index}")
94+
8595
# Both in tree: higher index = deeper
8696
if current_index is not None and external_index is not None:
97+
chosen = "current_span" if current_index > external_index else "external_span"
98+
logger.debug(f"Both in tree, choosing {chosen}")
8799
return current_span if current_index > external_index else external_span
88100

89101
# Only one in tree: that one is deeper
90102
if current_index is not None:
103+
logger.debug("Only current_span in tree, returning current_span")
91104
return current_span
92105
if external_index is not None:
106+
logger.debug("Only external_span in tree, returning external_span")
93107
return external_span
94108

95109
# Neither in tree: default to external
110+
logger.debug("Neither in tree, returning external_span")
96111
return external_span
97112

98113
@staticmethod

0 commit comments

Comments
 (0)