Skip to content

Commit c901acf

Browse files
authored
Added server_id, server_host and server_name as tags for influxdb (alexjustesen#305)
1 parent c6ae6aa commit c901acf

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

app/Jobs/SendDataToInfluxDbV2.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function handle()
5959

6060
$dataArray = [
6161
'name' => 'speedtest',
62-
'tags' => null,
62+
'tags' => $this->result->formatTagsForInfluxDB2(),
6363
'fields' => $this->result->formatForInfluxDB2(),
6464
'time' => strtotime($this->result->created_at),
6565
];

app/Models/Result.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,18 @@ class Result extends Model
5454
'created' => ResultCreated::class,
5555
];
5656

57+
/**
58+
* The tag attributes to be passed to influxdb
59+
*/
60+
public function formatTagsForInfluxDB2(): array
61+
{
62+
return [
63+
'server_id' => (int) $this->server_id,
64+
'server_host' => $this->server_host,
65+
'server_name' => $this->server_name,
66+
];
67+
}
68+
5769
/**
5870
* The attributes to be passed to influxdb
5971
*/

0 commit comments

Comments
 (0)