Skip to content

Commit 2bb13fa

Browse files
authored
Add jitter data to InfluxDB feed (alexjustesen#136)
1 parent 37405dd commit 2bb13fa

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

app/Models/Result.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class Result extends Model
4040
*/
4141
protected $casts = [
4242
'scheduled' => 'boolean',
43+
'data' => 'array',
4344
'created_at' => 'datetime',
4445
];
4546

@@ -53,10 +54,16 @@ public function formatForInfluxDB2()
5354
'ping' => (float) $this->ping,
5455
'download' => (int) $this->download,
5556
'upload' => (int) $this->upload,
57+
'download_bits' => (int) $this->download * 8,
58+
'upload_bits' => (int) $this->upload * 8,
59+
'ping_jitter' => (float) $this->data['ping']['jitter'],
60+
'download_jitter' => (float) $this->data['download']['latency']['jitter'],
61+
'upload_jitter' => (float) $this->data['upload']['latency']['jitter'],
5662
'server_id' => (int) $this->server_id,
5763
'server_host' => $this->server_host,
5864
'server_name' => $this->server_name,
5965
'scheduled' => $this->scheduled,
66+
'packet_loss' => $this->data['packetLoss'],
6067
];
6168
}
6269
}

0 commit comments

Comments
 (0)