File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed
sdk/monitor/azure-monitor-opentelemetry
azure/monitor/opentelemetry/_utils Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -194,8 +194,8 @@ def _default_sampling_ratio(configurations):
194194 elif sampler_type in (FIXED_PERCENTAGE_SAMPLER ,"microsoft.fixed.percentage" ): # to support older string
195195 try :
196196 sampler_value = float (sampler_arg ) if sampler_arg is not None else default_value
197- if sampler_value < 0.0 :
198- _logger .error ("Invalid value for OTEL_TRACES_SAMPLER_ARG. It should be a non-negative number ." )
197+ if sampler_value < 0.0 or sampler_value > 1.0 :
198+ _logger .error ("Invalid value for OTEL_TRACES_SAMPLER_ARG. It should be a value between 0 and 1 ." )
199199 sampler_value = default_value
200200 else :
201201 _logger .info ("Using sampling ratio: %s" , sampler_value )
Original file line number Diff line number Diff line change @@ -239,7 +239,7 @@ def test_get_configurations_env_vars_validation_check_backward_compatibility(sel
239239 self .assertEqual (configurations ["disable_logging" ], False )
240240 self .assertEqual (configurations ["disable_metrics" ], False )
241241 self .assertEqual (configurations ["disable_tracing" ], False )
242- self .assertEqual (configurations ["sampling_ratio" ], 10.45 )
242+ self .assertEqual (configurations ["sampling_ratio" ], 1.0 )
243243
244244 @patch .dict (
245245 "os.environ" ,
You can’t perform that action at this time.
0 commit comments