@@ -355,7 +355,7 @@ def test_sampling_request_callback():
355355
356356 probabilistic_strategy = """
357357 {
358- "strategyType":0 ,
358+ "strategyType":"PROBABILISTIC" ,
359359 "probabilisticSampling":
360360 {
361361 "samplingRate":0.002
@@ -374,7 +374,7 @@ def test_sampling_request_callback():
374374
375375 adaptive_sampling_strategy = """
376376 {
377- "strategyType":0 ,
377+ "strategyType":"PROBABILISTIC" ,
378378 "operationSampling":
379379 {
380380 "defaultSamplingProbability":0.001,
@@ -427,55 +427,55 @@ def test_sampling_request_callback():
427427
428428@pytest .mark .parametrize ("response,init_sampler,expected_sampler,err_count,err_msg,reference_equivalence" , [
429429 (
430- {"strategyType" :0 ,"probabilisticSampling" :{"samplingRate" :0.003 }},
430+ {"strategyType" :"PROBABILISTIC" ,"probabilisticSampling" :{"samplingRate" :0.003 }},
431431 probabilistic_sampler ,
432432 other_probabilistic_sampler ,
433433 0 ,
434434 'sampler should update to new probabilistic sampler' ,
435435 False ,
436436 ),
437437 (
438- {"strategyType" :0 ,"probabilisticSampling" :{"samplingRate" :400 }},
438+ {"strategyType" :"PROBABILISTIC" ,"probabilisticSampling" :{"samplingRate" :400 }},
439439 probabilistic_sampler ,
440440 probabilistic_sampler ,
441441 1 ,
442442 'sampler should remain the same if strategy is invalid' ,
443443 True ,
444444 ),
445445 (
446- {"strategyType" :0 ,"probabilisticSampling" :{"samplingRate" :0.002 }},
446+ {"strategyType" :"PROBABILISTIC" ,"probabilisticSampling" :{"samplingRate" :0.002 }},
447447 probabilistic_sampler ,
448448 probabilistic_sampler ,
449449 0 ,
450450 'sampler should remain the same with the same strategy' ,
451451 True ,
452452 ),
453453 (
454- {"strategyType" :1 ,"rateLimitingSampling" :{"maxTracesPerSecond" :10 }},
454+ {"strategyType" :"RATE_LIMITING" ,"rateLimitingSampling" :{"maxTracesPerSecond" :10 }},
455455 probabilistic_sampler ,
456456 rate_limiting_sampler ,
457457 0 ,
458458 'sampler should update to new rate limiting sampler' ,
459459 False ,
460460 ),
461461 (
462- {"strategyType" :1 ,"rateLimitingSampling" :{"maxTracesPerSecond" :10 }},
462+ {"strategyType" :"RATE_LIMITING" ,"rateLimitingSampling" :{"maxTracesPerSecond" :10 }},
463463 rate_limiting_sampler ,
464464 rate_limiting_sampler ,
465465 0 ,
466466 'sampler should remain the same with the same strategy' ,
467467 True ,
468468 ),
469469 (
470- {"strategyType" :1 ,"rateLimitingSampling" :{"maxTracesPerSecond" :- 10 }},
470+ {"strategyType" :"RATE_LIMITING" ,"rateLimitingSampling" :{"maxTracesPerSecond" :- 10 }},
471471 rate_limiting_sampler ,
472472 rate_limiting_sampler ,
473473 1 ,
474474 'sampler should remain the same if strategy is invalid' ,
475475 True ,
476476 ),
477477 (
478- {"strategyType" :1 ,"rateLimitingSampling" :{"maxTracesPerSecond" :20 }},
478+ {"strategyType" :"RATE_LIMITING" ,"rateLimitingSampling" :{"maxTracesPerSecond" :20 }},
479479 rate_limiting_sampler ,
480480 other_rate_limiting_sampler ,
481481 0 ,
@@ -491,7 +491,7 @@ def test_sampling_request_callback():
491491 True ,
492492 ),
493493 (
494- {"strategyType" :2 },
494+ {"strategyType" :"INVALID_TYPE" },
495495 rate_limiting_sampler ,
496496 rate_limiting_sampler ,
497497 1 ,
@@ -533,7 +533,7 @@ def test_update_sampler_adaptive_sampler():
533533 )
534534
535535 response = {
536- "strategyType" :1 ,
536+ "strategyType" :"RATE_LIMITING" ,
537537 "operationSampling" :
538538 {
539539 "defaultSamplingProbability" :0.001 ,
@@ -554,7 +554,7 @@ def test_update_sampler_adaptive_sampler():
554554 assert '%s' % remote_sampler .sampler == 'AdaptiveSampler(0.001000, 2.000000, 10)'
555555
556556 new_response = {
557- "strategyType" :1 ,
557+ "strategyType" :"RATE_LIMITING" ,
558558 "operationSampling" :
559559 {
560560 "defaultSamplingProbability" :0.51 ,
@@ -574,11 +574,11 @@ def test_update_sampler_adaptive_sampler():
574574 remote_sampler ._update_sampler (new_response )
575575 assert '%s' % remote_sampler .sampler == 'AdaptiveSampler(0.510000, 3.000000, 10)'
576576
577- remote_sampler ._update_sampler ({"strategyType" :0 ,"probabilisticSampling" :{"samplingRate" :0.004 }})
577+ remote_sampler ._update_sampler ({"strategyType" :"PROBABILISTIC" ,"probabilisticSampling" :{"samplingRate" :0.004 }})
578578 assert '%s' % remote_sampler .sampler == 'ProbabilisticSampler(0.004)' , \
579579 'should not fail going from adaptive sampler to probabilistic sampler'
580580
581- remote_sampler ._update_sampler ({"strategyType" :1 ,"operationSampling" :{"defaultSamplingProbability" :0.4 }})
581+ remote_sampler ._update_sampler ({"strategyType" :"RATE_LIMITING" ,"operationSampling" :{"defaultSamplingProbability" :0.4 }})
582582 assert '%s' % remote_sampler .sampler == 'AdaptiveSampler(0.400000, 0.001667, 10)'
583583
584584 remote_sampler .close ()
0 commit comments