BUGFIX message

This commit is contained in:
Gianluca Arbezzano
2014-09-10 12:47:26 +02:00
parent b9248c1e02
commit 8ba6332a08
3 changed files with 5 additions and 4 deletions
+2 -2
View File
@@ -23,13 +23,13 @@ class ClientSpec extends ObjectBehavior
function it_should_send_data(\InfluxDB\Adapter\AdapterInterface $adapter) function it_should_send_data(\InfluxDB\Adapter\AdapterInterface $adapter)
{ {
$adapter->send([ $adapter->send([[
"name" => "video.search", "name" => "video.search",
"columns" => ["author", "title"], "columns" => ["author", "title"],
"points" => [ "points" => [
["Guccini", "Autogrill"] ["Guccini", "Autogrill"]
] ]
])->shouldBeCalledTimes(1); ]])->shouldBeCalledTimes(1);
$this->mark("video.search", [ $this->mark("video.search", [
"author" => "Guccini", "author" => "Guccini",
+1
View File
@@ -47,6 +47,7 @@ class Udp implements AdapterInterface
public function send($message) public function send($message)
{ {
$message = json_encode($message);
socket_sendto($this->getSocket(), $message, strlen($message), 0, $this->host, $this->port); socket_sendto($this->getSocket(), $message, strlen($message), 0, $this->host, $this->port);
} }
} }
+2 -2
View File
@@ -29,11 +29,11 @@ class Client implements ClientInterface
public function mark($name, array $values) public function mark($name, array $values)
{ {
$data = []; $data =[];
$data['name'] = $name; $data['name'] = $name;
$data['columns'] = array_keys($values); $data['columns'] = array_keys($values);
$data['points'][] = array_values($values); $data['points'][] = array_values($values);
return $this->getAdapter()->send($data); return $this->getAdapter()->send([$data]);
} }
} }