1
votes

I'm using spring boot 2 actuator metrics to statistics API requests. But I face some issues, and I don't find so much relevant document.

Total number of requests resulted in a 4xx response

Total number of requests resulted in a 5xx response

1,

I can use http://localhost:8080/travel/actuator/metrics/http.server.requests?tag=status:400 to get status 400 info, but I'd like to know is there any method to wildcard 4xx request? or I have to loop all 4xx status codes one by one in my codes?

2,

  @GetMapping("/{type}/{code}")
  public Mono<ResponseEntity<Location>> getLocationByTypeAndCode(
  @NotNull @PathVariable("type") final String type,
  @NotNull @PathVariable("code") final String code) {

I use PathVariable parameters in my controller, but when I use http://localhost:8080/travel/actuator/metrics/http.server.requests?tag=uri:/locations/{type}/{code}

I got 400 bad request error

I'm new to Spring Boot Actuator, Many thanks for help!

1

1 Answers

0
votes

1: To get all the 4xx errors you can use: ?tag=outcome:CLIENT_ERROR.

2: The brackets need to be URL encoded: ?tag=uri:/locations/%7Btype%7D/%7Bcode%7D