Hi I am quite new to prometheus metrics. I need to expose the http_client_requests_seconds_count
and http_client_requests_seconds_sum
for the requests to the down stream servers.
I have enabled the prometheus in my project by
management:
endpoints:
web:
exposure:
include: health,metrics,prometheus
I have added dependencies as below in my pom.xml
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<version>${micrometer.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
and I can see the inbound matrix in http://localhost:8092/actuator/prometheus
. Like http_server_requests_seconds
and others but unable to find the downstream metrics.
I am using spring web-flux reactive framework.
As per this answer: stackoverflow.com/a/58632953 I tried it and found no luck. The simple answer is just to add
AutoWired
toWeclientBuilder
and build yourWebclient
out of it.Configure the metrics name in
application.yml
like below:That's it, you will get outbound metrics in
/atuator/prometheus....
Thanks! Happy coding