diff --git a/kong/timing/context.lua b/kong/timing/context.lua index 0d3b4f5c88f40..42e8b905664fd 100644 --- a/kong/timing/context.lua +++ b/kong/timing/context.lua @@ -91,9 +91,9 @@ function _M:finalize(subcontext) end -function _M:get_total_time_without_upstream() +function _M:get_total_time_without_upstream(context) local total_time = 0 - for k, child in pairs(self.root_context.child) do + for k, child in pairs(context.child) do if k ~= "upstream" and child.total_time then total_time = total_time + child.total_time end @@ -120,7 +120,7 @@ function _M:to_json() self:set_root_context_prop("dangling", dangling) self:finalize(self.root_context) - self.root_context.total_time_without_upstream = self:get_total_time_without_upstream() + self.root_context.total_time_without_upstream = self:get_total_time_without_upstream(self.root_context) return assert(cjson.encode(self.root_context)) end