From 40962766639f3a936691043e1920193e29783972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Wed, 7 Dec 2022 17:48:08 +0100 Subject: [PATCH] Make OTEL_TRACES_SAMPLER_ARG parsing locale invariant (#1722) --- .../Configuration/TracerSamplerHelper.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/OpenTelemetry.AutoInstrumentation/Configuration/TracerSamplerHelper.cs b/src/OpenTelemetry.AutoInstrumentation/Configuration/TracerSamplerHelper.cs index a2290f5e1..152772585 100644 --- a/src/OpenTelemetry.AutoInstrumentation/Configuration/TracerSamplerHelper.cs +++ b/src/OpenTelemetry.AutoInstrumentation/Configuration/TracerSamplerHelper.cs @@ -14,6 +14,7 @@ // limitations under the License. // +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; }