zlhgo opened a new issue, #6879:
URL: https://github.com/apache/apisix/issues/6879
### Description
I added `os.execute("sleep " .. 3)` code to the front of
_M.http_access_phase() function of the apisix/init.lua file.
then
```
curl flask-demo.dev.apisix.net:9080
```
nginx access log output:
```
127.0.0.1 - - [19/Apr/2022:14:34:41 +0800] flask-demo.dev.apisix.net:9080
"GET /headers HTTP/1.1" 200 20 request_time=3.005 "-" "curl/7.64.0"
127.0.0.1:8102 200 upstream_response_time=3.004
"http://flask-demo.dev.apisix.net:9080"
```
file-logger plugin output:
```json
{
"response": {
"status": 200,
"headers": {
"date": "Tue, 19 Apr 2022 06:24:31 GMT",
"server": "APISIX/2.11.0",
"x-request-id": "34305f201c9e8bf97a071726c5f9bf71",
"content-length": "9",
"content-type": "application/octet-stream",
"connection": "close"
},
"size": 219
},
"service_id": "",
"server": {
"hostname": "zlh-PC",
"version": "2.11.0"
},
"latency": 3005.0001144409,
"request": {
"headers": {
"host": "flask-demo.dev.apisix.net:9080",
"user-agent": "curl/7.64.0",
"accept": "*/*"
},
"url": "http://flask-demo.dev.apisix.net:9080/headers",
"method": "GET",
"querystring": {},
"size": 105,
"uri": "/headers"
},
"client_ip": "127.0.0.1",
"upstream": "127.0.0.1:8101",
"route_id": "379684400087963039",
"upstream_latency": 3004,
"apisix_latency": 1.000114440918,
"start_time": 1650349468195
}
```
Perhaps the 3 seconds consumed by the sleep function and the other lua code
execution time should not be counted in the upstream response time.
### Environment
- APISIX version (run `apisix version`):
- Operating system (run `uname -a`):
- OpenResty / Nginx version (run `openresty -V` or `nginx -V`):
- etcd version, if relevant (run `curl
http://127.0.0.1:9090/v1/server_info`):
- APISIX Dashboard version, if relevant:
- Plugin runner version, for issues related to plugin runners:
- LuaRocks version, for installation issues (run `luarocks --version`):
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]