Hello everyone, I am curious to find out if I can get ktor client micrometer metrics. The ktor server has the
MicrometerMetrics
feature but I don’t see an equivalent one for the ktor client. Am I missing something?
a
aleksey.tomin
10/19/2020, 2:30 PM
MicrometerMetrics
adds route to http server to publish metrics.
What do you want to do for ktor-client? How you want to publish metrics?
n
nikolaymetchev
10/19/2020, 2:42 PM
We have a microservice that is talking to an external service using ktor client. It would be nice to publish metrics about how long each http request is taking and be able to graph them so we can see if the external service is behaving abnormally.
a
aleksey.tomin
10/19/2020, 2:44 PM
You can publish something ONLY by ktor-server (or another http-server).
For collecting ktor-client metrics you have to create own implementation of
MeterBinder
aleksey.tomin
10/19/2020, 2:52 PM
We have a microservice
I think that any microservice has to contains http server for monitoring purpose.
n
nikolaymetchev
10/19/2020, 2:55 PM
Perhaps I haven’t explained myself very well. We have a microservice that is a ktor server. It already has
MicrometerMetrics
installed and is configurd to publish those metrics on
/metrics
. However some of the Rest API calls that are part of our microservice call out to an external service. So I would like to add more metrics to the already published set to cover ktor client calls.
a
aleksey.tomin
10/19/2020, 2:57 PM
You have to create an implementation of
MeterBinder
.
I haven’t found this in ktor-client.
PS: after this you may to do pull request into ktor :)