Skip to content

Add correct uri value on REST Client metrics when using RestClientBuilder #41769

Open

Description

Description

Not sure if working as expected or a bug, so reporting it as an enhancement

Currently, when using quarkus-micrometer-registry-prometheus and RestClientBuilder.newBuilder(), metrics are exposed as uri="root"; even if dynamic URI has a defined path.

Small reproducer:

@RegisterRestClient
public interface MyRemoteService {

	@GET
	Object getStreams();

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

	@GET
	public String hello() {
		MyRemoteService myRemoteService = RestClientBuilder.newBuilder()
				.baseUri(URI.create("https://code.quarkus.io/api/streams"))
				.build(MyRemoteService.class);

		return myRemoteService.getStreams().toString();
	}

}

Sample metrics:

# TYPE http_client_requests_seconds summary
# HELP http_client_requests_seconds  
http_client_requests_seconds_count{clientName="code.quarkus.io",method="GET",outcome="SUCCESS",status="200",uri="root"} 1.0
http_client_requests_seconds_sum{clientName="code.quarkus.io",method="GET",outcome="SUCCESS",status="200",uri="root"} 0.3211975
# TYPE http_client_requests_seconds_max gauge
# HELP http_client_requests_seconds_max  
http_client_requests_seconds_max{clientName="code.quarkus.io",method="GET",outcome="SUCCESS",status="200",uri="root"} 0.3211975

It shows the expected path/uri when @Path annotations are used instead of Programmatic client creation.
Expected value: /api/streams

Implementation ideas

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status

      Out of scope

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions