From 8ba6332a088f49dea2d0834af56df2fe3f56fabf Mon Sep 17 00:00:00 2001 From: Gianluca Arbezzano Date: Wed, 10 Sep 2014 12:47:26 +0200 Subject: [PATCH] BUGFIX message --- spec/InfluxDB/ClientSpec.php | 4 ++-- src/InfluxDB/Adapter/Udp.php | 1 + src/InfluxDB/Client.php | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) 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]); } }