You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently 'OpenTelemetry.Exporter.Prometheus' do not work with System.Diagnostics.Metric.ObservableGauge<T> parameterized with floating-point types. It works only with integer types.
Reproduce
Modify Console application from examples folder as follows.
In 'TestPrometheusExporter.cs' replace the following lines:
ObservableGauge<long> gauge = MyMeter.CreateObservableGauge<long>(
"Gauge",
() =>
{
var tag1 = new KeyValuePair<string, object>("tag1", "value1");
var tag2 = new KeyValuePair<string, object>("tag2", "value2");
return new List<Measurement<long>>()
{
new Measurement<long>(RandomGenerator.Next(1, 1000), tag1, tag2),
};
});
with these lines:
ObservableGauge<double> gauge = MyMeter.CreateObservableGauge<double>(
"Gauge",
() =>
{
var tag1 = new KeyValuePair<string, object>("tag1", "value1");
var tag2 = new KeyValuePair<string, object>("tag2", "value2");
return new List<Measurement<double>>()
{
new Measurement<double>(RandomGenerator.Next(1, 1000), tag1, tag2),
};
});
Build and start Console application with 'prometheus' command line parameter. It will print the following lines:
OpenTelemetry Prometheus Exporter is making metrics available at http://localhost:9184/metrics/
Press Enter key to exit now or will exit automatically after 2 minutes.
Hello, Cijo, I have checked the 'metrics' branch but did not found any fix there.
And 'OpenTelemetry.Exporter.Prometheus' still does not work with System.Diagnostics.Metric.ObservableGauge parameterized with floating-point types.
Could you please reopen the task, and close it, when the fix is commited?
Hello, Cijo, I have checked the 'metrics' branch but did not found any fix there.
And 'OpenTelemetry.Exporter.Prometheus' still does not work with System.Diagnostics.Metric.ObservableGauge parameterized with floating-point types.
Could you please reopen the task, and close it, when the fix is commited?
The SDK side was handling this correctly, but prometheus was not. Fix is coming: #2317
Bug Report
NuGet package: https://www.nuget.org/packages/OpenTelemetry.Exporter.Prometheus/1.2.0-alpha2
Runtime version: 'net5.0'
Symptom
Currently 'OpenTelemetry.Exporter.Prometheus' do not work with System.Diagnostics.Metric.ObservableGauge<T> parameterized with floating-point types. It works only with integer types.
Reproduce
Console
application fromexamples
folder as follows.In 'TestPrometheusExporter.cs' replace the following lines:
with these lines:
Console
application with 'prometheus' command line parameter. It will print the following lines:EXPECTED BEHAVIOR
There should be Gauge metrics like these:
OBSERVED BEHAVIOR
The patch with proposed fix
0001-Fixed-incorrect-MetricType-of-GaugeMetricAggregator.txt
The text was updated successfully, but these errors were encountered: