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.

when a resource return 404, the metrics does not return the uri called

See original GitHub issue

Description

when a resource return 404, the metrics does not return the uri called

http_server_requests_seconds_count{method="GET",outcome="CLIENT_ERROR",status="404",uri="NOT_FOUND",}

instead of

http_server_requests_seconds_count{method="GET",outcome="CLIENT_ERROR",status="404",uri="/hello-resteasy/{code}",}

it’s misleading, and for projects with more than one endpoint you cannot really tell what’s going on, and where are those 404

Analysis

i created a new quarkus project with:

features: [cdi, micrometer, resteasy]

the code is very simple. the problem happens with Response 404 and with throw new NotFoundException();

@Path("/hello-resteasy/{code}")
public class GreetingResource {

  @GET
  @Produces(MediaType.TEXT_PLAIN)
  public Response hello(@PathParam("code") Long l) {

      if (l == 5) {
          return Response.status(404).build();
      } else {
          return Response.ok("found").build();
      }
  }
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mmaggioni-wisecommented, Feb 26, 2021

I understand your point, but i do not agree. I don’t think 404 for non existing urls (eg /Totally/nonsense/URI ) are so common (maybe only the favicon, but we can live with that 😃 ) , and to me it makes more sense to track everything.

If we start to receive a lot of 404 for /hello/resteasy/{non_existing_resource} we won t see it, and we could miss an important information.

btw it’s not a problem. We will create a filter and a metric, it should be easy!

1reaction
ebullientcommented, Feb 25, 2021

404 URIs will not be displayed in metrics.

Log / trace analysis can reveal URIs that aren’t found, but the list of possible values is effectively infinite, and thus not suitable for a metrics tag.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it correct to return 404 when a REST resource is not found?
In other words, 404 means either a badly constructed URI or a reference to a ... Yes, it is pretty common to return...
Read more >
No uri tag for requests with responses other than 404 #534
server.requests metric by providing the NOT_FOUND value in case of requests that ended with the 404 responses. But what if service is configured ......
Read more >
Set up HTTP integrations in API Gateway - AWS Documentation
If the API exposes the ANY or GET method on the parent resource ( / ), the call returns a 404 Not Found...
Read more >
Build a trigger to collect custom metrics for HTTP 404 errors
In the Metrics field, type 404 and then select 404 Uri and Referrer, which is the custom metric created by the trigger. Note:...
Read more >
Handling Errors-Tableau Server REST API
In the example, the error code is 404002. The "404" part of the code indicates a "not found" error, which matches the HTTP...
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