Can't use Prometheus formatter - possibly example is wrong
FastNinja opened this issue · comments
Hi there,
I am trying to integrate Metrics into ASP net Core project and trying to use Prometheus formatter:
https://www.app-metrics.io/reporting/reporters/prometheus/
The line I am stuck is the following:
.UseMetrics(
options =>
{
options.EndpointOptions = endpointsOptions =>
{
endpointsOptions.MetricsTextEndpointOutputFormatter = metrics.OutputMetricsFormatters.GetType<MetricsPrometheusTextOutputFormatter>();
endpointsOptions.MetricsEndpointOutputFormatter = metrics.OutputMetricsFormatters.GetType<MetricsPrometheusProtobufOutputFormatter>();
};
})
of course this line fails:
The non-generic method 'object.GetType()' cannot be used with type arguments
I believe there is some kind of error in documentation - instead of GetType - it has to find special formatter using some other means...
Thanks, I'll take a look
@FastNinja GetType
is a custom extension method, yes not obvious I'll change this. Try importing the following namespace: App.Metrics.Formatters