Prometheus returns HTTP status 404 Not Found

4,177 views
Skip to first unread message

dianad...@gmail.com

unread,
Sep 12, 2017, 11:33:03 AM9/12/17
to Prometheus Users
Hi,

I have a .NET core application where I use a OWIN middleware to expose some metrics for Prometheus to scrape. I have added the endpoint in Prometheus configuration file and I can see it in the targets.
My problem is that Prometheus has issues reading the endpoint metrics depending on wether or not I short-circuit my middleware or not. If I do, it works perfectly - scrapes the metrics and the endpoint's status in targets is UP - but if I don't (and I call await nextHandler(requestContext)), Prometheus doesn't seem to reach it - the status says DOWN now and the error tab states that server returned HTTP status 404 Not Found

Any idea why this might be happening?

alin.si...@gmail.com

unread,
Sep 12, 2017, 5:55:29 PM9/12/17
to Prometheus Users
Try using curl to query your metrics page, or simply accessing it from your browser. If you can't reach it (which will most likely be the case) then the issue is in your app/middleware/whatever. (Sorry, no experience with .NET, so I can't help there.)

dianad...@gmail.com

unread,
Sep 13, 2017, 4:52:49 AM9/13/17
to Prometheus Users
I can access my metrics endpoint it in my browser (I see all the metrics, everything seems fine) but Prometheus returns 404 in the targets page for the specific endpoint. This is what is weird so that's why was wondering if anybody encountered a similar use case.

Alin Sînpălean

unread,
Sep 13, 2017, 6:17:00 AM9/13/17
to dianad...@gmail.com, Prometheus Users
It's weird (and somewhat hard to believe) that depending on whether you set up your app to do A or B (short circuit or not) Prometheus will either succeed connecting or get a 404 whereas your browser always connects successfully.

It may have to do with proxied vs. direct access or your server actually running on different ports or exposing the metrics on different paths in the 2 setups (essentially a configuration issue), but I am at a loss as to how your browser succeeds when Prometheus fails. You can start debugging by running curl or wget from the server where Prometheus is running, maybe your workstation/laptop has access to your app whereas the server doesn't.

On Wed, Sep 13, 2017 at 10:52 AM, <dianad...@gmail.com> wrote:
I can access my metrics endpoint it in my browser (I see all the metrics, everything seems fine) but Prometheus returns 404 in the targets page for the specific endpoint. This is what is weird so that's why was wondering if anybody encountered a similar use case.

--
You received this message because you are subscribed to a topic in the Google Groups "Prometheus Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/prometheus-users/bm3c41XcCBY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/5ee5dca0-8405-4e87-855f-184ac2e1ef40%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages