Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Micrometer: MP Rest Client metrics can not be turned off #15323

Closed
overthetop opened this issue Feb 25, 2021 · 3 comments
Closed

Micrometer: MP Rest Client metrics can not be turned off #15323

overthetop opened this issue Feb 25, 2021 · 3 comments
Labels

Comments

@overthetop
Copy link

overthetop commented Feb 25, 2021

Quarkus version: 1.12.0.Final

<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-micrometer</artifactId>
</dependency>
<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-registry-prometheus</artifactId>
</dependency>

I have a MP Rest Client with a few GET endpoints that contain an UUID in the path. Something like this

@Path("/endpoint/item/{uuid}")
@Produces(MediaType.APPLICATION_JSON)
@GET
List<Item> getItemsById(@PathParam("uuid") String uuid);

The problem is that I can't turn off metrics for the rest client using the standard configuration

quarkus.micrometer.enabled=true
quarkus.micrometer.binder-enabled-default=true
quarkus.micrometer.binder.mp-metrics.enabled=false
quarkus.micrometer.binder.http-client.enabled=false
quarkus.micrometer.binder.http-server.enabled=true

Everything works fine in Native mode, but not in JVM mode!
It's big issue because that results in a ton of metrics send to our stats server. The rest client emits metrics like this for each UUID

# HELP http_client_requests_seconds  
# TYPE http_client_requests_seconds summary
http_client_requests_seconds_count{clientName="c1",method="GET",outcome="SUCCESS",status="200",uri="/api/endpoint/item/17e458ad-8544-5922-b3c1-0ef6cca505a5",} 1.0
http_client_requests_seconds_sum{clientName="c1",method="GET",outcome="SUCCESS",status="200",uri="/api/endpoint/item/17e458ad-8544-5922-b3c1-0ef6cca505a5",} 0.081045893
http_client_requests_seconds_count{clientName="c1",method="GET",outcome="SUCCESS",status="200",uri="/api/endpoint/item/17e458ad-8544-5922-b3c1-0ef6cca505a5",} 1.0
http_client_requests_seconds_sum{clientName="c1",method="GET",outcome="SUCCESS",status="200",uri="/api/endpoint/item/17e458ad-8544-5922-b3c1-0ef6cca505a5",} 1.063181177

@overthetop overthetop added the kind/bug Something isn't working label Feb 25, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Feb 25, 2021

/cc @ebullient, @jmartisk, @phillip-kruger

@ebullient
Copy link
Member

  1. reproducer for the client enable/disable flag not working would be appreciated.
  2. I'm working on Clean up template URI matching; add support for servlets #15047 to sort out better automatic URI template matching
  3. In the meanwhile, as documented, use a matchPattern to map your client URLs (as in Client Metrics does not use template URI variables #15231):
    quarkus.micrometer.binder.http-client.match-pattern=/api/endpoint/item/[0-9]+=/api/endpoint/item/{endpointId}

@overthetop
Copy link
Author

micrometer-rest-client.zip
@ebullient open http://localhost:8080/api/hit-it a few times and then see the metrics in http://localhost:8080/q/metrics

http_client_requests_seconds_count{clientName="localhost",method="GET",outcome="SUCCESS",status="200",uri="/api/endpoint/954161ed-dc97-4418-8d27-4a56d867c56e",} 1.0
http_client_requests_seconds_sum{clientName="localhost",method="GET",outcome="SUCCESS",status="200",uri="/api/endpoint/954161ed-dc97-4418-8d27-4a56d867c56e",} 0.022902028
http_client_requests_seconds_count{clientName="localhost",method="GET",outcome="SUCCESS",status="200",uri="/api/endpoint/d1b385ad-a5bd-4833-a74a-88a3c14c7b80",} 1.0
http_client_requests_seconds_sum{clientName="localhost",method="GET",outcome="SUCCESS",status="200",uri="/api/endpoint/d1b385ad-a5bd-4833-a74a-88a3c14c7b80",} 0.040398535
http_client_requests_seconds_count{clientName="localhost",method="GET",outcome="SUCCESS",status="200",uri="/api/endpoint/2f0266b3-73a1-47da-ac32-4901e80900ac",} 1.0

the config is

quarkus.micrometer.enabled=true
quarkus.micrometer.binder-enabled-default=true
quarkus.micrometer.binder.mp-metrics.enabled=false
quarkus.micrometer.binder.http-client.enabled=false
quarkus.micrometer.binder.http-server.enabled=false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants