I want to capture metrics (number of calls, 95th percentile) about calls made from my backend service to other third party services. I am using WebClient to make these http calls. I couldn't find a specific property to enable WebClient Histogram metrics.
I have added MetricsWebClientFilterFunction to generate the metrics. Here is the logic -
WebClient webClient = WebClient.builder() .baseUrl(SERVICE_URL) .filter(new MetricsWebClientFilterFunction(meterRegistry, new DefaultWebClientExchangeTagsProvider(), "webClientCalls", AutoTimer.ENABLED)) .build();
Its generating only count and sum metrics. How can I generate histogram metrics for WebClient calls?
Here is the output in /actuator/prometheus endpoint -
webClientCalls_seconds_count{clientName="service_url",method="GET",outcome="SUCCESS",status="200",uri="/hello",} 1.0 webClientCalls_seconds_sum{clientName="service_url",method="GET",outcome="SUCCESS",status="200",uri="/hello",} 2.301044994
webClientCalls_seconds_max{clientName="service_url",method="GET",outcome="SUCCESS",status="200",uri="/hello",} 0.0