2929 env = dict (
3030 DD_PROFILING_MAX_FRAMES = "5" ,
3131 DD_PROFILING_OUTPUT_PPROF = "/tmp/test_collect_truncate" ,
32- DD_PROFILING_STACK_V2_ENABLED = "1" ,
3332 )
3433)
3534@pytest .mark .skipif (sys .version_info [:2 ] == (3 , 7 ), reason = "stack_v2 is not supported on Python 3.7" )
@@ -61,9 +60,8 @@ def test_collect_truncate():
6160 assert len (sample .location_id ) <= max_nframes + 2 , len (sample .location_id )
6261
6362
64- @pytest .mark .parametrize ("stack_v2_enabled" , [True , False ])
65- def test_stack_locations (stack_v2_enabled , tmp_path ):
66- if sys .version_info [:2 ] == (3 , 7 ) and stack_v2_enabled :
63+ def test_stack_locations (tmp_path ):
64+ if sys .version_info [:2 ] == (3 , 7 ):
6765 pytest .skip ("stack_v2 is not supported on Python 3.7" )
6866
6967 test_name = "test_stack_locations"
@@ -83,7 +81,7 @@ def bar():
8381 def foo ():
8482 bar ()
8583
86- with stack .StackCollector (None , _stack_collector_v2_enabled = stack_v2_enabled ):
84+ with stack .StackCollector (None , _stack_collector_v2_enabled = True ):
8785 for _ in range (10 ):
8886 foo ()
8987 ddup .upload ()
@@ -117,9 +115,8 @@ def foo():
117115 pprof_utils .assert_profile_has_sample (profile , samples = samples , expected_sample = expected_sample )
118116
119117
120- @pytest .mark .parametrize ("stack_v2_enabled" , [True , False ])
121- def test_push_span (stack_v2_enabled , tmp_path , tracer ):
122- if sys .version_info [:2 ] == (3 , 7 ) and stack_v2_enabled :
118+ def test_push_span (tmp_path , tracer ):
119+ if sys .version_info [:2 ] == (3 , 7 ):
123120 pytest .skip ("stack_v2 is not supported on Python 3.7" )
124121
125122 test_name = "test_push_span"
@@ -140,7 +137,7 @@ def test_push_span(stack_v2_enabled, tmp_path, tracer):
140137 tracer = tracer ,
141138 endpoint_collection_enabled = True ,
142139 ignore_profiler = True , # this is not necessary, but it's here to trim samples
143- _stack_collector_v2_enabled = stack_v2_enabled ,
140+ _stack_collector_v2_enabled = True ,
144141 ):
145142 with tracer .trace ("foobar" , resource = resource , span_type = span_type ) as span :
146143 span_id = span .span_id
@@ -221,9 +218,8 @@ def target_fun():
221218 unregister_thread .assert_called_with (thread_id )
222219
223220
224- @pytest .mark .parametrize ("stack_v2_enabled" , [True , False ])
225- def test_push_non_web_span (stack_v2_enabled , tmp_path , tracer ):
226- if sys .version_info [:2 ] == (3 , 7 ) and stack_v2_enabled :
221+ def test_push_non_web_span (tmp_path , tracer ):
222+ if sys .version_info [:2 ] == (3 , 7 ):
227223 pytest .skip ("stack_v2 is not supported on Python 3.7" )
228224
229225 tracer ._endpoint_call_counter_span_processor .enable ()
@@ -244,7 +240,7 @@ def test_push_non_web_span(stack_v2_enabled, tmp_path, tracer):
244240 tracer = tracer ,
245241 endpoint_collection_enabled = True ,
246242 ignore_profiler = True , # this is not necessary, but it's here to trim samples
247- _stack_collector_v2_enabled = stack_v2_enabled ,
243+ _stack_collector_v2_enabled = True ,
248244 ):
249245 with tracer .trace ("foobar" , resource = resource , span_type = span_type ) as span :
250246 span_id = span .span_id
@@ -269,10 +265,9 @@ def test_push_non_web_span(stack_v2_enabled, tmp_path, tracer):
269265 )
270266
271267
272- @pytest .mark .parametrize ("stack_v2_enabled" , [True , False ])
273- def test_push_span_none_span_type (stack_v2_enabled , tmp_path , tracer ):
268+ def test_push_span_none_span_type (tmp_path , tracer ):
274269 # Test for https://github.com/DataDog/dd-trace-py/issues/11141
275- if sys .version_info [:2 ] == (3 , 7 ) and stack_v2_enabled :
270+ if sys .version_info [:2 ] == (3 , 7 ):
276271 pytest .skip ("stack_v2 is not supported on Python 3.7" )
277272
278273 test_name = "test_push_span_none_span_type"
@@ -292,7 +287,7 @@ def test_push_span_none_span_type(stack_v2_enabled, tmp_path, tracer):
292287 tracer = tracer ,
293288 endpoint_collection_enabled = True ,
294289 ignore_profiler = True , # this is not necessary, but it's here to trim samples
295- _stack_collector_v2_enabled = stack_v2_enabled ,
290+ _stack_collector_v2_enabled = True ,
296291 ):
297292 # Explicitly set None span_type as the default could change in the
298293 # future.
@@ -484,9 +479,8 @@ def test_exception_collection_trace(stack_v2_enabled, tmp_path, tracer):
484479 )
485480
486481
487- @pytest .mark .parametrize ("stack_v2_enabled" , [True , False ])
488- def test_collect_once_with_class (stack_v2_enabled , tmp_path ):
489- if sys .version_info [:2 ] == (3 , 7 ) and stack_v2_enabled :
482+ def test_collect_once_with_class (tmp_path ):
483+ if sys .version_info [:2 ] == (3 , 7 ):
490484 pytest .skip ("stack_v2 is not supported on Python 3.7" )
491485
492486 class SomeClass (object ):
@@ -506,7 +500,7 @@ def sleep_instance(self):
506500 ddup .config (env = "test" , service = test_name , version = "my_version" , output_filename = pprof_prefix )
507501 ddup .start ()
508502
509- with stack .StackCollector (None , ignore_profiler = True , _stack_collector_v2_enabled = stack_v2_enabled ):
503+ with stack .StackCollector (None , ignore_profiler = True , _stack_collector_v2_enabled = True ):
510504 SomeClass .sleep_class ()
511505
512506 ddup .upload ()
@@ -521,7 +515,6 @@ def sleep_instance(self):
521515 expected_sample = pprof_utils .StackEvent (
522516 thread_id = _thread .get_ident (),
523517 thread_name = "MainThread" ,
524- class_name = "SomeClass" if not stack_v2_enabled else None ,
525518 locations = [
526519 pprof_utils .StackLocation (
527520 function_name = "sleep_instance" ,
@@ -536,16 +529,15 @@ def sleep_instance(self):
536529 pprof_utils .StackLocation (
537530 function_name = "test_collect_once_with_class" ,
538531 filename = "test_stack.py" ,
539- line_no = test_collect_once_with_class .__code__ .co_firstlineno + 23 ,
532+ line_no = test_collect_once_with_class .__code__ .co_firstlineno + 22 ,
540533 ),
541534 ],
542535 ),
543536 )
544537
545538
546- @pytest .mark .parametrize ("stack_v2_enabled" , [True , False ])
547- def test_collect_once_with_class_not_right_type (stack_v2_enabled , tmp_path ):
548- if sys .version_info [:2 ] == (3 , 7 ) and stack_v2_enabled :
539+ def test_collect_once_with_class_not_right_type (tmp_path ):
540+ if sys .version_info [:2 ] == (3 , 7 ):
549541 pytest .skip ("stack_v2 is not supported on Python 3.7" )
550542
551543 class SomeClass (object ):
@@ -565,7 +557,7 @@ def sleep_instance(foobar, self):
565557 ddup .config (env = "test" , service = test_name , version = "my_version" , output_filename = pprof_prefix )
566558 ddup .start ()
567559
568- with stack .StackCollector (None , ignore_profiler = True , _stack_collector_v2_enabled = stack_v2_enabled ):
560+ with stack .StackCollector (None , ignore_profiler = True , _stack_collector_v2_enabled = True ):
569561 SomeClass .sleep_class (123 )
570562
571563 ddup .upload ()
@@ -580,9 +572,6 @@ def sleep_instance(foobar, self):
580572 expected_sample = pprof_utils .StackEvent (
581573 thread_id = _thread .get_ident (),
582574 thread_name = "MainThread" ,
583- # stack v1 relied on using cls and self to figure out class name
584- # so we can't find it here.
585- class_name = None ,
586575 locations = [
587576 pprof_utils .StackLocation (
588577 function_name = "sleep_instance" ,
@@ -597,7 +586,7 @@ def sleep_instance(foobar, self):
597586 pprof_utils .StackLocation (
598587 function_name = "test_collect_once_with_class_not_right_type" ,
599588 filename = "test_stack.py" ,
600- line_no = test_collect_once_with_class_not_right_type .__code__ .co_firstlineno + 23 ,
589+ line_no = test_collect_once_with_class_not_right_type .__code__ .co_firstlineno + 22 ,
601590 ),
602591 ],
603592 ),
0 commit comments