【问题标题】:Micrometer Reactor Netty Http Client Metrics vs Http Client MetricsMicrometer Reactor Netty Http 客户端指标与 Http 客户端指标
【发布时间】:2021-12-05 11:38:14
【问题描述】:

在构建 Reactor Netty 应用程序时,我得到了两个相似的指标。但它们之间究竟有什么区别呢?

http_client_requests_secondsreactor_netty_http_client_response_time_seconds

我无法弄清楚它们测量响应时间的方式/位置有何不同。哪一个测量的时间更长并不一致。

Http 客户端指标测量时间更长

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 指标测量时间更长

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

【问题讨论】:

    标签: spring-boot spring-webflux metrics reactor-netty micrometer


    【解决方案1】:

    这个reactor_netty_http_client_response_time_seconds 由 Reactor Netty 提供。

    测量是这样进行的:

    开始时间是你大约to send the request

    停止时间是您从服务器herehere收到最后一个包时

    这不包括从池中获取连接的时间(如果池中有连接,这可能可以忽略不计,但当池中没有连接并且需要建立连接时,这可能需要时间)。对于连接建立,还有另一个指标reactor_netty_http_client_connect_time。对于 TLS 握手,还有 reactor_netty_http_client_tls_handshake_time

    更多关于 Reactor Netty 指标如地址解析等,你可以在the reference documentation找到

    【讨论】:

    • 谢谢!从编写代码的人那里得到答案总是很高兴。
    猜你喜欢
    • 1970-01-01
    • 2018-06-03
    • 2019-07-24
    • 1970-01-01
    • 2011-01-24
    • 1970-01-01
    • 1970-01-01
    • 2016-09-28
    • 1970-01-01
    相关资源
    最近更新 更多