When building a Reactor Netty application I get two similar metrics. But what's actually the difference between them?
http_client_requests_seconds
vs. reactor_netty_http_client_response_time_seconds
I can't figure out what the differences are in how/where they measure the response time. It's not consistent which one measures longer time.
Http Client metrics mesures longer time
reactor_netty_http_client_response_time_seconds_count{method="POST",remote_address="localhost:8184",status="200",uri="/api/endpoint",} 2.0
reactor_netty_http_client_response_time_seconds_sum{method="POST",remote_address="localhost:8184",status="200",uri="/api/endpoint",} 0.048153964
http_client_requests_seconds_count{clientName="localhost",method="POST",outcome="SUCCESS",status="200",uri="/api/endpoint",} 2.0
http_client_requests_seconds_sum{clientName="localhost",method="POST",outcome="SUCCESS",status="200",uri="/api/endpoint",} 0.167178945
Reactor Netty metrics mesures longer time
http_client_requests_seconds_count{clientName="localhost",method="POST",outcome="SUCCESS",status="200",uri="/api/another",} 2.0
http_client_requests_seconds_sum{clientName="localhost",method="POST",outcome="SUCCESS",status="200",uri="/api/another",} 0.049176211
reactor_netty_http_client_response_time_seconds_count{method="POST",remote_address="localhost:8184",status="200",uri="/api/another",} 2.0
reactor_netty_http_client_response_time_seconds_sum{method="POST",remote_address="localhost:8184",status="200",uri="/api/another",} 0.046602377
This one reactor_netty_http_client_response_time_seconds
is provided by Reactor Netty.
The measuring happens like this:
The start time is when you are about to send the request
The stop time is when you receive the last package from the server here and here
This does not include the time for obtaining the connection from the pool (this might be negligible if there is a connection in the pool, but also this might take time when there is no connection in the pool and such needs to be established). For the connection establishment there is another metric reactor_netty_http_client_connect_time
. Also for TLS handshake there is reactor_netty_http_client_tls_handshake_time
.
More about Reactor Netty metrics as address resolution etc., you can find in the reference documentation