new to Prometheus here.
I added it to my Core2.1 project and Startup.cs
I am doing:
public static IApplicationBuilder UseCustomMetricsMiddleware(this IApplicationBuilder app)
{
app.UseHttpMetrics();
var histogram = //...custom histogram
var counter = //...custom counter
app.UseMiddleware<HttpRequestDurationMiddleware>(histogram);
app.UseMiddleware<HttpRequestCountMiddleware>(counter);
return app;
}
This works and I get the histogram and the counter printing out. However when I do a POST that returns 500 in postman and in the logs:
HTTP POST /endpoint responded with 500 in 7506.6286 ms
Prometheus will print 200
:
# TYPE http_request_counter counter
http_request_counter{code="200",method="POST"} 1
This is obviously wrong. The logs and Postman clearly show a 500
response, so I am trying to understand why Prometheus doesn't record the status correctly.
Any help is appreciated.
Thanks