Add Response Time column to health check table
This commit is contained in:
parent
7e59b7e88b
commit
1957e273ec
|
@ -99,7 +99,7 @@ class EnvironmentCheckSuite
|
|||
}
|
||||
|
||||
/**
|
||||
* Run this test suite and return the result code of the worst result.
|
||||
* Run this test suite and return the result code of the worst result and the time it took.
|
||||
*
|
||||
* @return EnvironmentCheckSuiteResult
|
||||
*/
|
||||
|
@ -110,13 +110,15 @@ class EnvironmentCheckSuite
|
|||
foreach ($this->checkInstances() as $check) {
|
||||
list($checkClass, $checkTitle) = $check;
|
||||
try {
|
||||
$startTime = microtime(true);
|
||||
list($status, $message) = $checkClass->check();
|
||||
$responseTime = number_format((microtime(true) - $startTime), 4, '.', '') . 's';
|
||||
// If the check fails, register that as an error
|
||||
} catch (Exception $e) {
|
||||
$status = EnvironmentCheck::ERROR;
|
||||
$message = $e->getMessage();
|
||||
}
|
||||
$result->addResult($status, $message, $checkTitle);
|
||||
$result->addResult($status, $message, $checkTitle, $responseTime);
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
|
|
@ -35,12 +35,13 @@ class EnvironmentCheckSuiteResult extends ViewableData
|
|||
* @param string $message
|
||||
* @param string $checkIdentifier
|
||||
*/
|
||||
public function addResult($status, $message, $checkIdentifier)
|
||||
public function addResult($status, $message, $checkIdentifier, $responseTime)
|
||||
{
|
||||
$this->details->push(new ArrayData([
|
||||
'Check' => $checkIdentifier,
|
||||
'Status' => $this->statusText($status),
|
||||
'StatusCode' => $status,
|
||||
'ResponseTime' => $responseTime,
|
||||
'Message' => $message,
|
||||
]));
|
||||
|
||||
|
|
|
@ -66,9 +66,9 @@
|
|||
|
||||
<% if $IncludeDetails %>
|
||||
<table>
|
||||
<tr><th>Check</th> <th>Status</th> <th>Message</th></tr>
|
||||
<tr><th>Check</th> <th>Status</th> <th>Response Time</th> <th>Message</th></tr>
|
||||
<% loop $Details %>
|
||||
<tr><td>$Check</td> <td class="$Status">$Status</td> <td>$Message.XML</td></tr>
|
||||
<tr><td>$Check</td> <td class="$Status">$Status</td> <td class="$ResponseTime">$ResponseTime</td> <td>$Message.XML</td></tr>
|
||||
<% end_loop %>
|
||||
</table>
|
||||
<% end_if %>
|
||||
|
|
Loading…
Reference in New Issue