How do I get templated values in uri tag for http-client-requests metrics using ReactiveFeignClient?

577 Views Asked by At

We are using Spring Boot 2.7.8 and the micrometer-registry-prometheus dependency to capture metrics.

We use feign-reactor-webclient:3.2.6 to call out to another service. The metrics being generated by this call contain the actual values in the URI instead of the templated values.

For example, in the /actuator/prometheus endpoint, I see entries like this: http_client_requests_seconds_count{clientName="someClient",method="GET",status="200",uri="/person/lookup?firstName=Tony&lastName=Soprano",} 1.0

I would expect to see the variable names rather than the values, like this:

http_client_requests_seconds_count{clientName="someClient",method="GET",status="200",uri="/person/lookup?firstName={firstName}&lastName={lastName}",} 1.0

Is there a way to get the default http.client.requests metric values to use the templated values for the URI tag?

2

There are 2 best solutions below

1
On

The Reactive Feign package com.playtika.reactivefeign:feign-reactor-spring-cloud-starter contains a property called reactive.feign.metrics.enabled, which is disabled by default, but when enabled will record metrics with the URI template. You can read https://github.com/PlaytikaOSS/feign-reactive/tree/develop/feign-reactor-spring-configuration for more details.

Related Issues:

Related Code:

0
On

I have the same problem here.

I haven't deployed the change to the production environment yet, but changing the feign-micrometer version locally (from 11.6 to 11.8) was enough to store the template, without changing any configuration.