'No http client metrics for non 200 response codes in Quarkus Micrometer

I have the following Quarkus Rest client code (based on this doc https://quarkus.io/guides/rest-client)

@RegisterRestClient(baseUri = "https://pesho3.free.beeceptor.com")
interface TokenService {

    @POST
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    @Produces(MediaType.APPLICATION_JSON)
    @ClientHeaderParam(
        name = "Authorization",
        value = ["Basic asdasd"]
    )
    fun getToken(
        @FormParam("grant_type") grantType: String = "client_credentials",
        @FormParam("scope") scope: String = "IIG-HIP-NP/Read"
    ): JSONObject
}

When I call my getToken() method and get http 200 I get automatically generated metrics in localhost:8080/q/metrics (as stated in this doc https://quarkus.io/guides/micrometer#review-automatically-generated-metrics)

e.g

http_client_requests_seconds_count{clientName="pesho3.free.beeceptor.com",method="POST",outcome="SUCCESS",status="200",uri="root",} 2.0
http_client_requests_seconds_sum{clientName="pesho3.free.beeceptor.com",method="POST",outcome="SUCCESS",status="200",uri="root",} 1.116203

I don't get any metrics for non 200 codes.. How can I expose them ?



Solution 1:[1]

I found the solution.. Its this property (not mentioned in Quarkus doc)

microprofile.rest.client.disable.default.mapper=true

The answer was in this doc:

 https://download.eclipse.org/microprofile/microprofile-rest-client-1.3/microprofile-rest-client-1.3.html#_default_responseexceptionmapper

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Lucky me