Skip to content

Commit 1836a36

Browse files
authored
fix(perf) typo and better intermediate error handling (Kong#7177)
1 parent d332f8e commit 1836a36

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

.github/workflows/perf.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
if [[ -z $tags ]]; then
7777
tags="simple"
7878
fi
79-
elif [[ $suite == "/flamegraph" ]]; then
79+
elif [[ $suite == "/perf" ]]; then
8080
suites="01-rps"
8181
if [[ -z $tags ]]; then
8282
tags="baseline,single_route"

spec/helpers/perf.lua

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,7 @@ function _M.start_stapxx(sample_name, ...)
218218
end
219219

220220
--- Wait the load test to finish and get result
221-
-- @function start_load
222-
-- @param opts.path string request path
221+
-- @function wait_result
223222
-- @return string the test report text
224223
function _M.wait_result(opts)
225224
if not load_thread then
@@ -282,14 +281,16 @@ local function sum(t)
282281
end
283282

284283
-- Note: could also use custom lua code in wrk
284+
local nan = 0/0
285285
local function parse_wrk_result(r)
286286
local rps = string.match(r, "Requests/sec:%s+([%d%.]+)")
287287
rps = tonumber(rps)
288288
local count = string.match(r, "([%d]+)%s+requests in")
289289
count = tonumber(count)
290+
-- Note: doesn't include case where unit is us: Latency 0.00us 0.00us 0.00us -nan%
290291
local lat_avg, avg_m, lat_max, max_m = string.match(r, "Latency%s+([%d%.]+)(m?)s%s+[%d%.]+m?s%s+([%d%.]+)(m?)s")
291-
lat_avg = tonumber(lat_avg) * (avg_m == "m" and 1 or 1000)
292-
lat_max = tonumber(lat_max) * (max_m == "m" and 1 or 1000)
292+
lat_avg = tonumber(lat_avg or nan) * (avg_m == "m" and 1 or 1000)
293+
lat_max = tonumber(lat_max or nan) * (max_m == "m" and 1 or 1000)
293294
return rps, count, lat_avg, lat_max
294295
end
295296

spec/helpers/perf/drivers/terraform.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ function _M:setup(opts)
131131
-- self.log.debug("(In a low voice) pg_password is " .. PG_PASSWORD)
132132

133133
self.log.info("Infra is up! However, executing psql remotely may take a while...")
134-
package.loaded["spec.helpers"] = nil
135-
for i=1, 3 do
134+
for i=1, 3 do
135+
package.loaded["spec.helpers"] = nil
136136
local pok, pret = pcall(require, "spec.helpers")
137137
if pok then
138138
return pret

0 commit comments

Comments
 (0)