10000 Remove global span caching. · DataDog/datadog-lambda-python@335d7da · GitHub
[go: up one dir, main page]

Skip to content

Commit 335d7da

Browse files
committed
Remove global span caching.
1 parent bb9e8e0 commit 335d7da

File tree

1 file changed

+2
-30
lines changed

1 file changed

+2
-30
lines changed

tests/test_tracing.py

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -49,32 +49,6 @@
4949

5050
event_samples = "tests/event_samples/"
5151

52-
span_to_finish = None
53-
54-
55-
def _clean_up_span():
56-
global span_to_finish
57-
if span_to_finish is not None:
58-
span_to_finish.finish()
59-
span_to_finish = None
60-
61-
62-
def register_span(span):
63-
global span_to_finish
64-
_clean_up_span()
65-
span_to_finish = span
66-
return span
67-
68-
69-
def wrapped_span_creator(span_creator_func):
70-
def result_func(*args, **kwargs):
71-
return register_span(span_creator_func(*args, **kwargs))
72-
73-
return result_func
74-
75-
76-
create_inferred_span = wrapped_span_creator(create_inferred_span)
77-
7852

7953
class ClientContext(object):
8054
def __init__(self, custom=None):
@@ -1881,20 +1855,18 @@ def test_create_inferred_span(mock_span_finish, source, expect):
18811855
assert actual.get_tag(tag) == value, f"wrong value for tag {tag}"
18821856

18831857
if expect.parent_name is not None:
1884-
assert mock_span_finish.call_count == 2
1858+
assert mock_span_finish.call_count == 1
18851859
args, kwargs = mock_span_finish.call_args_list[0]
18861860
parent = args[0]
18871861
finish_time = kwargs.get("finish_time") or args[1]
18881862
assert parent.name == expect.parent_name
18891863
assert actual.parent_id == parent.span_id
18901864
assert finish_time == expect.start
18911865
else:
1892-
assert mock_span_finish.call_count < 2
1866+
assert mock_span_finish.call_count == 0
18931867

18941868

18951869
class TestInferredSpans(unittest.TestCase):
1896-
def tearDown(self):
1897-
_clean_up_span()
18981870

18991871
def test_extract_context_from_eventbridge_event(self):
19001872
event_sample_source = "eventbridge-custom"

0 commit comments

Comments
 (0)
0