Display latency in milliseconds instead of seconds
This commit is contained in:
parent
c314511e2e
commit
8614e7453c
|
@ -74,7 +74,7 @@ class HistoryGraph
|
|||
1 => $this->generateGraphHistory($server_id, $last_year, $last_week),
|
||||
);
|
||||
$info_fields = array(
|
||||
'latency_avg' => '%01.4f',
|
||||
'latency_avg' => '%01.5f',
|
||||
'uptime' => '%01.3f%%',
|
||||
);
|
||||
|
||||
|
@ -280,11 +280,11 @@ class HistoryGraph
|
|||
if ($record['status'] == 0) {
|
||||
$lines['online'][] = $prev['status']
|
||||
// Previous datapoint was online
|
||||
? '{ x: ' . ($time * 1000) . ', y: ' . $prev['latency'] . '}'
|
||||
? '{ x: ' . ($time * 1000) . ', y: ' . $prev['latency'] * 1000 . '}'
|
||||
// Previous datapoint was offline
|
||||
: '{ x: ' . ($time * 1000) . ', y: null}';
|
||||
// new outage start
|
||||
$lines['offline'][] = '{ x: ' . ($time * 1000) . ', y:0.1}';
|
||||
$lines['offline'][] = '{ x: ' . ($time * 1000) . ', y:' . $highest_latency . '}';
|
||||
|
||||
$prev_downtime != 0 ?: $prev_downtime = $time;
|
||||
} else {
|
||||
|
@ -294,15 +294,15 @@ class HistoryGraph
|
|||
// Previous datapoint was online
|
||||
? '{ x: ' . ($time * 1000) . ', y:null}'
|
||||
// Previous datapoint was offline
|
||||
: '{ x: ' . ($time * 1000) . ', y:0.1}';
|
||||
: '{ x: ' . ($time * 1000) . ', y:' . $highest_latency . '}';
|
||||
$lines['online'][] = '{ x: ' . ($time * 1000) . ', y: ' .
|
||||
round((float) $record[$key], 4) . '}';
|
||||
round((float) $record[$key] * 1000, 2) . '}';
|
||||
|
||||
$prev_downtime == 0 ?: $downtime += ($time - $prev_downtime);
|
||||
$prev_downtime = 0;
|
||||
}
|
||||
} else {
|
||||
$lines[$key][] = '{ x: \'' . $record['date'] . '\', y: ' . $record[$key] . '}';
|
||||
$lines[$key][] = '{ x: \'' . $record['date'] . '\', y: ' . $record[$key] * 1000 . '}';
|
||||
}
|
||||
$prev = $record;
|
||||
}
|
||||
|
@ -312,7 +312,8 @@ class HistoryGraph
|
|||
// Record the first and last date as a string in the down array
|
||||
$prev_downtime == 0 ?: $downtime += ($now->getTimestamp() - $prev_downtime);
|
||||
if ($add_uptime) {
|
||||
$prev['status'] ?: $lines['offline'][] = '{ x: ' . ($now->getTimestamp() * 1000) . ', y:0.1}';
|
||||
$prev['status'] ?: $lines['offline'][] =
|
||||
'{ x: ' . ($now->getTimestamp() * 1000) . ', y:' . $highest_latency . '}';
|
||||
$data['uptime'] = 100 - ($downtime / ($end_time->getTimestamp() - $start_time->getTimestamp()));
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<span id="needle" style="transform: rotate({{ ((graph.uptime|round/100)*180)|round }}deg);"></span>
|
||||
</div><br>
|
||||
{% endif %}
|
||||
{{ graph.info.0.label }}: {{ graph.info.0.value }}s
|
||||
{{ graph.info.0.label }}: {{ graph.info.0.value * 1000 }} ms
|
||||
</div>
|
||||
|
||||
{% if graph.id == 'history_short' %}
|
||||
|
@ -30,7 +30,7 @@
|
|||
data: {
|
||||
datasets: [
|
||||
{
|
||||
data: [{{ graph.lines.offline.value * 1000 }}],
|
||||
data: [{{ graph.lines.offline.value }}],
|
||||
label: '{{ graph.lines.offline.name }}',
|
||||
backgroundColor: '#dc3545',
|
||||
borderColor: '#dc3545',
|
||||
|
@ -41,7 +41,7 @@
|
|||
spanGaps: false,
|
||||
},
|
||||
{
|
||||
data: [{{ graph.lines.online.value * 1000 }}],
|
||||
data: [{{ graph.lines.online.value }}],
|
||||
label: '{{graph.lines.online.name }}',
|
||||
fill: false,
|
||||
spanGaps: false,
|
||||
|
|
Loading…
Reference in New Issue