https://kotlinlang.org logo
#ktor
Title
# ktor
m

Marcin Wisniowski

01/05/2020, 12:45 AM
Hello, how would I go about measuring response times? Let's say I want to
println
something like "responded to /some/endpoint in 50ms" for every request. I have found I can access every request with
Copy code
intercept(ApplicationCallPipeline.Monitoring){ /**/ }
but I'd like to access every response before it's sent and some information about it.
d

Dico

01/05/2020, 7:52 AM
Well you'd probably want to intercept at some point during intercept pipeline and at the sending phase again for a second timestamp.
You can use attributes on the call to mark the time of reception
m

Marcin Wisniowski

01/05/2020, 1:26 PM
That works! Thank you.
👍🏻 1