Skip to content

Commit

Permalink
added check duration to array reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
Narek Poghosyan committed Sep 1, 2023
1 parent 35a6b37 commit 2d62b5b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Helper/ArrayReporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class ArrayReporter implements ReporterInterface

private $globalStatus = self::STATUS_OK;
private $results = [];
private $checkRunTime = 0;

public function getResults(): array
{
Expand Down Expand Up @@ -65,6 +66,7 @@ public function onAfterRun(CheckInterface $check, ResultInterface $result, $chec
'status' => $status,
'status_name' => $statusName,
'service_id' => $checkAlias,
'duration' => microtime(true) - $this->checkRunTime,
];
}

Expand All @@ -81,7 +83,7 @@ public function onStart(\ArrayObject $checks, $runnerConfig)
*/
public function onBeforeRun(CheckInterface $check, $checkAlias = null)
{
return;
$this->checkRunTime = microtime(true);
}

/**
Expand Down

0 comments on commit 2d62b5b

Please sign in to comment.