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 Aug 31, 2023
1 parent 35a6b37 commit 2406088
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea/
/Tests/app/cache
/Tests/app/logs
/Tests/app/var
Expand Down
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' => round(microtime(true) - $this->checkRunTime, 2),
];
}

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 2406088

Please sign in to comment.