ASP.NET Prometheus Exporter does not return any data when used in a dotnet 6 project
PaulRitter opened this issue · 2 comments
Bug Report
ASP.NET Prometheus Exporter does not return any data when used in a dotnet 6 project. In an identical dotnet 8 project it works fine.
Symptom
If you target dotnet6 in an aspnet project and try to use the prometheus exporter, it will not return any metrics: The scraping endpoint will always just return # EOF
. Furthermore, the diagnostic log shows no signs of error, always showing the following:
[Timestamp...]:MetricReader event: '{0}'{BaseExportingMetricReader calling OpenTelemetry.Exporter.Prometheus.PrometheusExporter.Export method.}
[Timestamp...]:MetricReader event: '{0}'{OpenTelemetry.Exporter.Prometheus.PrometheusExporter.Export succeeded.}
After many frustrating hours of trying to get my dotnet 6 project to use the prometheus exporter, I discovered that an otherwise identical aspnet project, with the only difference being that it targets dotnet 8, will have the exporter working.
To make sure this wasn't something wrong with my local install, I built a reproduction with two identical projects which target dotnet6 and dotnet8, both being built into a docker container from official images.
Reproduce
The reproduction can be found here, I hope I didnt miss anything and it is intuitive enough: https://github.com/PaulRitter/OpenTelemetryPrometheusRepro
The reproduction uses the following packages (both are the latest versions as of now):
OpenTelemetry.Exporter.Prometheus.AspNetCore 1.7.0-rc.1
OpenTelemetry.Extensions.Hosting 1.7.0
Thanks in advance, Paul
Are these meters existing in ASP.NET Core 6? I think the answer is no - these were added in .NET 8.
Removing the bug tag and closing as not a bug. @PaulRitter please feel free to reopen the issue if you believe it is a Prometheus Exporter bug.