Hi, I'm very exited with KTor and I'm using it for several microservices. I created a Feature to integrate prometheus metrics on the http server. It was very easy. Then I created a Feature for the client side, but I got a little confused with the client pipelines and which is the best place to add the interceptor for measure total request time. I want to add to the measure the returned status code from the http response. Any help to understand pipelines and the proper place to inject metrics will be welcome. (edited)
e
e5l
05/20/2020, 12:22 PM
Hi @Carlos Fau, Could you tell me if you want to measure time from first
request
byte to first
response
byte or from first
request
byte to last
response
byte?
c
Carlos Fau
05/20/2020, 12:25 PM
Hi @e5l, I was wanting to measure until "last response byte", but if you can provide me both points I think no far in the future I will need to add the time to "first response byte"
e
e5l
05/20/2020, 12:27 PM
HttpResponse
and
HttpRequest
classes have
requestTime
and
responseTime
it will give you the metric for first case. You can use
HttpSend
interceptor to observe it.
e5l
05/20/2020, 12:28 PM
Get second metric could be complex if the response is streaming. Could you tell me if you need streaming?
c
Carlos Fau
05/20/2020, 12:29 PM
Not by the moment, so I can go with your info and in case in future I desperately need it I'll return to the channel.
Thanks a lot for your help