[Question] Request 404 per Controller per Method
See original GitHub issueHi, I have tried but failed as to how to enable 404 and other error code for controller and Action calls. What I get is an overall 404.
Any help would be appreciated.
# TYPE http_request_duration_seconds histogram http_request_duration_seconds_sum{code="404",method="GET",controller="",action="" } 0.0002027 http_request_duration_seconds_count{code="404",method="GET",controller="",action="" } 1 http_request_duration_seconds_bucket{code="404",method="GET",controller="",action="",le="0.001"} 1 http_request_duration_seconds_bucket{code="404",method="GET",controller="",action="",le="0.002"} 1 http_request_duration_seconds_bucket{code="404",method="GET",controller="",action="",le="0.004"} 1 http_request_duration_seconds_bucket{code="404",method="GET",controller="",action="",le="0.008"} 1 http_request_duration_seconds_bucket{code="404",method="GET",controller="",action="",le="0.016"} 1 http_request_duration_seconds_bucket{code="404",method="GET",controller="",action="",le="0.032"} 1 http_request_duration_seconds_bucket{code="404",method="GET",controller="",action="",le="0.064"} 1 http_request_duration_seconds_bucket{code="404",method="GET",controller="",action="",le="0.128"} 1 http_request_duration_seconds_bucket{code="404",method="GET",controller="",action="",le="0.256"} 1 http_request_duration_seconds_bucket{code="404",method="GET",controller="",action="",le="0.512"} 1 http_request_duration_seconds_bucket{code="404",method="GET",controller="",action="",le="1.024"} 1 http_request_duration_seconds_bucket{code="404",method="GET",controller="",action="",le="2.048"} 1 http_request_duration_seconds_bucket{code="404",method="GET",controller="",action="",le="4.096"} 1 http_request_duration_seconds_bucket{code="404",method="GET",controller="",action="",le="8.192"} 1 http_request_duration_seconds_bucket{code="404",method="GET",controller="",action="",le="16.384"} 1 http_request_duration_seconds_bucket{code="404",method="GET",controller="",action="",le="32.768"} 1 http_request_duration_seconds_bucket{code="404",method="GET",controller="",action="",le="+Inf"} 1
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
@yazdan Yeah, what you have makes sense to me. In my case I was looking at some requests where the path was not found like /api/SomePathThatDoesNotExist. So, of course, the controller was set to “” in that case because there is no SomePathThatDoesNotExistController mapped. In my case this was happening because we had some software that was pinging an URL that did not exist. On the other hand, your request like
"/f/contents/7-1-1-introduction_imageurl-486017_t_0_75_o.jpeg
failed.I suspect that you have a static content handler wired up and it is checking the path and returning a 404 when it is unable to find the file in question. It would never map to a controller, since it isn’t a Web API per se.
I think that the only way one would ever get a metric like
http_request_duration_seconds_bucket{code="404",method="GET",controller="GetFuzzy",action="",le="1.024"} 16
would be if you had a controller GetFuzzyController.cs that handled a get method and returned a 404 from the web method. (Perhaps there would be a parameter like GetFuzzy?name=‘George Fuzzy’ and George was not found in the database.I didn’t write this package though so you might want to take what I say with a grain of salt.
There is now
options.AddCustomLabel()
which may help cover gaps in cases where you want custom labels to differentiate metrics that do not have controllers/actions. There is also support for automatically addingendpoint
andpage
labels. This is available in v6.0.0 prerelease package at the moment. Any feedback is most welcome, especially during preview!As it sounds like the comments above have accurately described the situation, I will close this as “by design and/or improved support exists in newer version”.