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
2 changes: 1 addition & 1 deletion sdk/core/azure-core/azure/core/tracing/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def wrapper_use_tracer(self, *args, **kwargs):
original_span_instance = wrapper_class.get_current_span()
parent_span = common.get_parent_span(passed_in_parent)
ans = None
if parent_span is not None:
if parent_span is not None and orig_wrapped_span is None:
common.set_span_contexts(parent_span)
name = name_of_span or self.__class__.__name__ + "." + func.__name__
child = parent_span.span(name=name)
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/azure-core/azure/core/tracing/decorator_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def wrapper_use_tracer(self, *args, **kwargs):
original_span_instance = wrapper_class.get_current_span()
parent_span = common.get_parent_span(passed_in_parent)
ans = None
if parent_span is not None:
if parent_span is not None and orig_wrapped_span is None:
common.set_span_contexts(parent_span)
name = name_of_span or self.__class__.__name__ + "." + func.__name__
child = parent_span.span(name=name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,10 @@ async def test_span_with_opencensus_complicated(value):
parent = exporter.root
assert len(parent.children) == 4
assert parent.children[0].span_data.name == "MockClient.__init__"
assert not parent.children[0].children
assert parent.children[1].span_data.name == "MockClient.make_request"
assert parent.children[1].children[0].span_data.name == "MockClient.get_foo"
assert parent.children[1].children[1].span_data.name == "MockClient.make_request"
assert not parent.children[1].children
assert parent.children[2].span_data.name == "child"
assert parent.children[2].children[0].span_data.name == "MockClient.make_request"
assert parent.children[3].span_data.name == "MockClient.make_request"
assert parent.children[3].children[0].span_data.name == "MockClient.get_foo"
assert parent.children[3].children[1].span_data.name == "MockClient.make_request"
children = parent.children[1].children
assert len(children) == 2
assert not parent.children[3].children
9 changes: 3 additions & 6 deletions sdk/core/azure-core/tests/test_tracing_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,10 @@ def test_span_with_opencensus_complicated(self, value):
parent = exporter.root
assert len(parent.children) == 4
assert parent.children[0].span_data.name == "MockClient.__init__"
assert not parent.children[0].children
assert parent.children[1].span_data.name == "MockClient.make_request"
assert parent.children[1].children[0].span_data.name == "MockClient.get_foo"
assert parent.children[1].children[1].span_data.name == "MockClient.make_request"
assert not parent.children[1].children
assert parent.children[2].span_data.name == "child"
assert parent.children[2].children[0].span_data.name == "MockClient.make_request"
assert parent.children[3].span_data.name == "MockClient.make_request"
assert parent.children[3].children[0].span_data.name == "MockClient.get_foo"
assert parent.children[3].children[1].span_data.name == "MockClient.make_request"
children = parent.children[1].children
assert len(children) == 2
assert not parent.children[3].children