question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] Request 404 per Controller per Method

See original GitHub issue

Hi, 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:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
GlennSillsUKGcommented, Jul 14, 2021

@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.

0reactions
sandersaarescommented, Feb 20, 2022

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 adding endpoint and page 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”.

Read more comments on GitHub >

github_iconTop Results From Across the Web

404 error when passing parameter to method on WebAPi ...
1 Answer 1 ... Turns out the 404 issue is a misleading error, it's really not a bad route. The easiest solution is...
Read more >
Controller action works but still gives 404
I have a controller class in which I have a function that sets a cookie. I call on this function from within a...
Read more >
Creating an ASP.NET Core API Controller but getting 404 ...
Basically, I inject the userRepository and call each method depending on the route, but I'm getting 404 error on Post and Get routes...
Read more >
404 error when send request to web api controller
Solution 1​​ 404 is "page not found". You are looking for a route that does not exist. As "j snooze" mentions, as part...
Read more >
Net core api 404 not found. So finally I found why I get a 404
NET Core Web Api post request 404 Not Found. 1) application. NET 6 and locally, I can see all controllers working and using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found