[英]How to measure complete response time (request in to response received by client ) in Play! framework?
I'm a new user of playframework. 我是playframework的新用户。 In a project of mine, I want to measure how long it takes from when a HTTP request comes in until the last byte of the response has been received by the client. 在我的一个项目中,我想测量从发出HTTP请求到客户端收到响应的最后一个字节要花费多长时间。 I'm calling this period of time "response time". 我称这段时间为“响应时间”。 In a netty log, I can see: 在网络日志中,我可以看到:
2016-11-17 10:32:00,712 [DEBUG] from io.netty.handler.logging.LoggingHandler in netty-event-loop-3 - [id: 0xb4fb943a, L:/127.0.0.1:9001 - R:/127.0.0.1:50871] WRITE: DefaultFullHttpResponse(decodeResult: success, version: HTTP/1.1, content: ReadOnlyByteBufferBuf(ridx: 0, widx: 655, cap: 655/655))
2016-11-17 10:32:00,713 [DEBUG] from io.netty.handler.logging.LoggingHandler in netty-event-loop-3 - [id: 0xb4fb943a, L:/127.0.0.1:9001 - R:/127.0.0.1:50871] FLUSH
2016-11-17 10:32:00,713 [DEBUG] from io.netty.handler.logging.LoggingHandler in netty-event-loop-3 - [id: 0xb4fb943a, L:/127.0.0.1:9001 - R:/127.0.0.1:50871] FLUSH
2016-11-17 10:37:19,311 [DEBUG] from io.netty.handler.logging.LoggingHandler in netty-event-loop-3 - [id: 0xb4fb943a, L:/127.0.0.1:9001 ! R:/127.0.0.1:50871] INACTIVE
2016-11-17 10:37:19,312 [DEBUG] from io.netty.handler.logging.LoggingHandler in netty-event-loop-3 - [id: 0xb4fb943a, L:/127.0.0.1:9001 ! R:/127.0.0.1:50871] UNREGISTERED
I can get the response time from the log (from WRITE to FLUSH?), but is there any way to get the "response time" more easily? 我可以从日志中获取响应时间(从WRITE到FLUSH?),但是有什么方法可以更轻松地获取“响应时间”吗? What I need is to measure the "response time" as a metric and log it or send it to Grafana. 我需要的是将“响应时间”作为度量标准进行度量并将其记录或发送给Grafana。
Thanks everyone! 感谢大家!
You can either: 您可以:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.