census-instrumentation / opencensus-csharp

Distributed tracing and stats collecting framework
https://opencensus.io
Apache License 2.0
139 stars 32 forks source link

Prometheus exporter outputs values of invalid format under certain culture settings #143

Closed jacostro closed 5 years ago

jacostro commented 5 years ago

Hi, When running the sample for Prometheus (TestPrometheus.cs) Prometheus server reports invalid data format in:

# HELP my_org_views_video_sizeprocessed video size over time
my_org_views_video_size{my_org_keys_frontend="mobile-ios9.3.5"} 173189802,666667 1555493470457

Culture setting for my machine is pl-PL. Apparently there's a problem with a comma which separates decimal places of the value. The source of the problem is writing a double value by StreamWriter.Write(double) in PrometheusMetricBuilder.Write, which applies national settings. I suppose this should be replaced by something like:

writer.Write(m.Value.ToString("G", CultureInfo.InvariantCulture));
SergeyKanzhelev commented 5 years ago

moved to OpenTelemetry