spacewander commented on code in PR #7036:
URL: https://github.com/apache/apisix/pull/7036#discussion_r872003420


##########
apisix/stream/xrpc/runner.lua:
##########
@@ -27,6 +27,19 @@ local pcall = pcall
 local ipairs = ipairs
 local tostring = tostring
 
+
+core.ctx.register_var("rpc_time", function(ctx)
+    local curr_ctx = ctx.xrpc_session and ctx.xrpc_session._curr_ctx
+
+    if not curr_ctx then
+        core.log.warn("can't find current context by id: ", curr_ctx_id)
+        return nil
+    end
+    --use second as the unit, like the request_time
+    local time = (curr_ctx._rpc_end_time * 1000 - curr_ctx._rpc_start_time * 
1000) / 1000

Review Comment:
   Why do we multiply 1000 first and divide by 1000 later?



##########
t/xrpc/redis.t:
##########
@@ -565,3 +577,126 @@ passed
 --- response_body
 ok
 --- stream_conf_enable
+
+
+
+=== TEST 12: set custom log format

Review Comment:
   Maybe we can split the redis variable into another PR and the test can be 
put into `redis2.t`. Otherwise, there will be merge conflict.



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

Reply via email to