diff --git a/spec/InfluxDB/ClientSpec.php b/spec/InfluxDB/ClientSpec.php index 1af2fffb7a..fc34b91ec7 100644 --- a/spec/InfluxDB/ClientSpec.php +++ b/spec/InfluxDB/ClientSpec.php @@ -23,13 +23,13 @@ class ClientSpec extends ObjectBehavior function it_should_send_data(\InfluxDB\Adapter\AdapterInterface $adapter) { - $adapter->send([ + $adapter->send([[ "name" => "video.search", "columns" => ["author", "title"], "points" => [ ["Guccini", "Autogrill"] ] - ])->shouldBeCalledTimes(1); + ]])->shouldBeCalledTimes(1); $this->mark("video.search", [ "author" => "Guccini", diff --git a/src/InfluxDB/Adapter/Udp.php b/src/InfluxDB/Adapter/Udp.php index 63cddff37b..5afd301fcc 100644 --- a/src/InfluxDB/Adapter/Udp.php +++ b/src/InfluxDB/Adapter/Udp.php @@ -47,6 +47,7 @@ class Udp implements AdapterInterface public function send($message) { + $message = json_encode($message); socket_sendto($this->getSocket(), $message, strlen($message), 0, $this->host, $this->port); } } diff --git a/src/InfluxDB/Client.php b/src/InfluxDB/Client.php index 884d8a9a62..3965b643b2 100644 --- a/src/InfluxDB/Client.php +++ b/src/InfluxDB/Client.php @@ -29,11 +29,11 @@ class Client implements ClientInterface public function mark($name, array $values) { - $data = []; + $data =[]; $data['name'] = $name; $data['columns'] = array_keys($values); $data['points'][] = array_values($values); - return $this->getAdapter()->send($data); + return $this->getAdapter()->send([$data]); } }