Changing measurement to name in result set

This commit is contained in:
danibrutal
2015-06-18 14:22:51 +02:00
parent 87121d2126
commit 7d91bb0519
3 changed files with 20 additions and 4 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ class ResultSet
$points = array();
foreach ($this->getSeries() as $serie) {
if ($serie['measurement'] == $metricName || array_intersect($tags, $serie['tags'])) {
if ($serie['name'] == $metricName || array_intersect($tags, $serie['tags'])) {
$points = array_merge($points, $this->getPointsFromSerie($serie));
}
}
+16
View File
@@ -24,6 +24,22 @@ class ResultSetTest extends \PHPUnit_Framework_TestCase
new ResultSet($invalidJSON);
}
/**
* Throws Exception if something went wrong with influxDB
* @expectedException \Leaseweb\InfluxDB\InfluxDBClientError
*/
public function testThrowsInfluxDBException()
{
$errorResult = <<<EOD
{
"series": [],
"error": "Big error, many problems."
}
EOD;
new ResultSet($errorResult);
}
/**
* We can get points from measurement
*/
+3 -3
View File
@@ -3,7 +3,7 @@
{
"series": [
{
"measurement": "cpu_load_short",
"name": "cpu_load_short",
"tags": {
"host": "server01",
"region": "us-west"
@@ -20,7 +20,7 @@
]
},
{
"measurement": "cpu_load_short",
"name": "cpu_load_short",
"tags": {
"host": "server02",
"region": "us-west"
@@ -37,7 +37,7 @@
]
},
{
"measurement": "other_serie",
"name": "other_serie",
"tags": {
"host": "server01",
"region": "us-west"