From 356526a60dd1fe43f070e27804a1868f70232b5c Mon Sep 17 00:00:00 2001 From: Tobias Bauriedel Date: Thu, 15 Aug 2024 11:58:21 +0200 Subject: [PATCH] update to support carbonapi --- library/Graphite/Graphing/MetricsQuery.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/library/Graphite/Graphing/MetricsQuery.php b/library/Graphite/Graphing/MetricsQuery.php index 93d0c907..f0c6e215 100644 --- a/library/Graphite/Graphing/MetricsQuery.php +++ b/library/Graphite/Graphing/MetricsQuery.php @@ -169,15 +169,21 @@ public function fetchColumn() } $client = $this->dataSource->getClient(); - $url = Url::fromPath('metrics/expand', [ + $url = Url::fromPath('metrics/find', [ 'query' => $this->base->resolve($filter, '*') ]); $res = Json::decode($client->request($url)); - natsort($res->results); - IPT::recordf('Fetched %s metric(s) from %s', count($res->results), (string) $client->completeUrl($url)); + $results = []; + foreach ($res as $item) { + $results[] = $item->id; + } - return array_values($res->results); + natsort($results); + + IPT::recordf('Fetched %s metric(s) from %s', count($results), (string) $client->completeUrl($url)); + + return array_values($results); } public function fetchOne() @@ -217,3 +223,4 @@ protected function escapeMetricStep($step) return preg_replace('/[^a-zA-Z0-9\*\-:^[\]$#%\']/', '_', $step); } } +