Skip to content

Commit

Permalink
Prevent from "Cannot read properties of undefined" if responseTime or…
Browse files Browse the repository at this point in the history
… responseSize is missing.

Second try.
  • Loading branch information
hudeldudel committed May 14, 2024
1 parent 6ec600a commit 7683d3f
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions prober/prober.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,26 +112,30 @@ class Prober {
});

for (const [key, execution] of Object.entries(summary.run.executions)) {
// response time
if (execution.response.responseTime !== undefined) {
responseTimeGauge.set(
{
'iteration': execution.cursor.iteration,
'position': execution.cursor.position,
'request_name': execution.item.name
},
execution.response.responseTime / 1000);
}

if (execution.response) {
// response time
if (execution.response.responseTime) {
responseTimeGauge.set(
{
'iteration': execution.cursor.iteration,
'position': execution.cursor.position,
'request_name': execution.item.name
},
execution.response.responseTime / 1000);
}

// response size
if (execution.response.responseSize) {
responseSizeGauge.set(
{
'iteration': execution.cursor.iteration,
'position': execution.cursor.position,
'request_name': execution.item.name
},
execution.response.responseSize);
}

// response size
if (execution.response.responseSize !== undefined) {
responseSizeGauge.set(
{
'iteration': execution.cursor.iteration,
'position': execution.cursor.position,
'request_name': execution.item.name
},
execution.response.responseSize);
}

// assertions
Expand Down

0 comments on commit 7683d3f

Please sign in to comment.