@@ -43,28 +43,28 @@ def print_cube(self, num):
43
43
44
44
def print_square_with_thread (self , num ):
45
45
with self .tracer .start_as_current_span ("square" ):
46
- t2 = threading .Thread (target = self .print_cube , args = (10 ,))
46
+ cube_thread = threading .Thread (target = self .print_cube , args = (10 ,))
47
47
print ("Square: {}" .format (num * num ))
48
- t2 .start ()
49
- t2 .join ()
48
+ cube_thread .start ()
49
+ cube_thread .join ()
50
50
51
51
def calculate (self , num ):
52
52
with self .tracer .start_as_current_span ("calculate" ):
53
- t1 = threading .Thread (target = self .print_square , args = (num ,))
54
- t2 = threading .Thread (target = self .print_cube , args = (num ,))
55
- t1 .start ()
56
- t1 .join ()
53
+ square_thread = threading .Thread (target = self .print_square , args = (num ,))
54
+ cube_thread = threading .Thread (target = self .print_cube , args = (num ,))
55
+ square_thread .start ()
56
+ square_thread .join ()
57
57
58
- t2 .start ()
59
- t2 .join ()
58
+ cube_thread .start ()
59
+ cube_thread .join ()
60
60
61
61
62
62
def test_without_thread_nesting (self ):
63
- t1 = threading .Thread (target = self .print_square , args = (10 ,))
63
+ square_thread = threading .Thread (target = self .print_square , args = (10 ,))
64
64
65
65
with self .tracer .start_as_current_span ("root" ):
66
- t1 .start ()
67
- t1 .join ()
66
+ square_thread .start ()
67
+ square_thread .join ()
68
68
69
69
spans = self .memory_exporter .get_finished_spans ()
70
70
self .assertEqual (len (spans ), 2 )
@@ -75,12 +75,12 @@ def test_without_thread_nesting(self):
75
75
self .assertIsNone (root .parent )
76
76
77
77
def test_with_thread_nesting (self ):
78
- t1 = threading .Thread (target = self .print_square_with_thread , args = (10 ,))
78
+ square_thread = threading .Thread (target = self .print_square_with_thread , args = (10 ,))
79
79
80
80
81
81
with self .tracer .start_as_current_span ("root" ):
82
- t1 .start ()
83
- t1 .join ()
82
+ square_thread .start ()
83
+ square_thread .join ()
84
84
85
85
spans = self .memory_exporter .get_finished_spans ()
86
86
@@ -93,11 +93,11 @@ def test_with_thread_nesting(self):
93
93
self .assertIsNone (root .parent )
94
94
95
95
def test_with_thread_multi_nesting (self ):
96
- t1 = threading .Thread (target = self .calculate , args = (10 ,))
96
+ calculate_thread = threading .Thread (target = self .calculate , args = (10 ,))
97
97
98
98
with self .tracer .start_as_current_span ("root" ):
99
- t1 .start ()
100
- t1 .join ()
99
+ calculate_thread .start ()
100
+ calculate_thread .join ()
101
101
102
102
spans = self .memory_exporter .get_finished_spans ()
103
103
@@ -113,9 +113,9 @@ def test_with_thread_multi_nesting(self):
113
113
def test_uninstrumented (self ):
114
114
ThreadingInstrumentor ().uninstrument ()
115
115
116
- t1 = threading .Thread (target = self .print_square , args = (10 ,))
117
- t1 .start ()
118
- t1 .join ()
116
+ square_thread = threading .Thread (target = self .print_square , args = (10 ,))
117
+ square_thread .start ()
118
+ square_thread .join ()
119
119
spans = self .memory_exporter .get_finished_spans ()
120
120
self .assertEqual (len (spans ), 1 )
121
121
0 commit comments