Make OTEL_TRACES_SAMPLER_ARG parsing locale invariant (#1722)

This commit is contained in:
Robert Pająk 2022-12-07 17:48:08 +01:00 committed by GitHub
parent 47806aca4f
commit 4096276663
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -14,6 +14,7 @@
// limitations under the License.
// </copyright>
using System.Globalization;
using OpenTelemetry.Trace;
namespace OpenTelemetry.AutoInstrumentation.Configuration;
@ -47,7 +48,8 @@ internal static class TracerSamplerHelper
var ratio = defaultRatio;
if (double.TryParse(arguments, out var parsedRatio) && parsedRatio >= 0.0 && parsedRatio <= 1.0)
if (double.TryParse(arguments, NumberStyles.Any, CultureInfo.InvariantCulture, out var parsedRatio)
&& parsedRatio >= 0.0 && parsedRatio <= 1.0)
{
ratio = parsedRatio;
}