zhendongcmss edited a comment on issue #5146:
URL: https://github.com/apache/apisix/issues/5146#issuecomment-928933666
Facts proved `ngx.update_time()` doesn't work.
```
@@ -150,12 +150,17 @@ function _M.log(conf, ctx)
metrics.latency:observe(latency,
gen_arr("request", vars.status, method_id, route_id, service_id,
consumer_name, balancer_ip))
+ ngx.update_time()
local apisix_latency = latency
if ctx.var.upstream_response_time then
local upstream_latency = ctx.var.upstream_response_time * 1000
metrics.latency:observe(upstream_latency,
gen_arr("upstream", vars.status, method_id, route_id,
service_id, consumer_name, balancer_ip))
apisix_latency = apisix_latency - upstream_latency
+ if apisix_latency < 0 then
+ ngx.log(ngx.EMERG, "123456789","latency now ", ngx.now(), ",
start_time: ", ngx.req.start_time(), ", upstream: ",
+ ctx.var.upstream_response_time)
+ end
```

--
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]