Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support carbonapi #328

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions library/Graphite/Graphing/MetricsQuery.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

Check failure on line 1 in library/Graphite/Graphing/MetricsQuery.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Ignored error pattern #^Cannot access property \$results on mixed\.$# in path /home/runner/work/icingaweb2-module-graphite/icingaweb2-module-graphite/library/Graphite/Graphing/MetricsQuery.php was not matched in reported errors.

Check failure on line 1 in library/Graphite/Graphing/MetricsQuery.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Ignored error pattern #^Cannot access property \$results on mixed\.$# in path /home/runner/work/icingaweb2-module-graphite/icingaweb2-module-graphite/library/Graphite/Graphing/MetricsQuery.php was not matched in reported errors.

Check failure on line 1 in library/Graphite/Graphing/MetricsQuery.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Ignored error pattern #^Cannot access property \$results on mixed\.$# in path /home/runner/work/icingaweb2-module-graphite/icingaweb2-module-graphite/library/Graphite/Graphing/MetricsQuery.php was not matched in reported errors.

Check failure on line 1 in library/Graphite/Graphing/MetricsQuery.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Ignored error pattern #^Cannot access property \$results on mixed\.$# in path /home/runner/work/icingaweb2-module-graphite/icingaweb2-module-graphite/library/Graphite/Graphing/MetricsQuery.php was not matched in reported errors.

Check failure on line 1 in library/Graphite/Graphing/MetricsQuery.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Ignored error pattern #^Cannot access property \$results on mixed\.$# in path /home/runner/work/icingaweb2-module-graphite/icingaweb2-module-graphite/library/Graphite/Graphing/MetricsQuery.php was not matched in reported errors.

Check failure on line 1 in library/Graphite/Graphing/MetricsQuery.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Ignored error pattern #^Cannot access property \$results on mixed\.$# in path /home/runner/work/icingaweb2-module-graphite/icingaweb2-module-graphite/library/Graphite/Graphing/MetricsQuery.php was not matched in reported errors.

Check failure on line 1 in library/Graphite/Graphing/MetricsQuery.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Ignored error pattern #^Cannot access property \$results on mixed\.$# in path /home/runner/work/icingaweb2-module-graphite/icingaweb2-module-graphite/library/Graphite/Graphing/MetricsQuery.php was not matched in reported errors.

namespace Icinga\Module\Graphite\Graphing;

Expand Down Expand Up @@ -169,15 +169,21 @@
}

$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) {

Check failure on line 178 in library/Graphite/Graphing/MetricsQuery.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Argument of an invalid type mixed supplied for foreach, only iterables are supported.

Check failure on line 178 in library/Graphite/Graphing/MetricsQuery.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Argument of an invalid type mixed supplied for foreach, only iterables are supported.

Check failure on line 178 in library/Graphite/Graphing/MetricsQuery.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Argument of an invalid type mixed supplied for foreach, only iterables are supported.

Check failure on line 178 in library/Graphite/Graphing/MetricsQuery.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Argument of an invalid type mixed supplied for foreach, only iterables are supported.

Check failure on line 178 in library/Graphite/Graphing/MetricsQuery.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Argument of an invalid type mixed supplied for foreach, only iterables are supported.

Check failure on line 178 in library/Graphite/Graphing/MetricsQuery.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Argument of an invalid type mixed supplied for foreach, only iterables are supported.

Check failure on line 178 in library/Graphite/Graphing/MetricsQuery.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Argument of an invalid type mixed supplied for foreach, only iterables are supported.
$results[] = $item->id;

Check failure on line 179 in library/Graphite/Graphing/MetricsQuery.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Cannot access property $id on mixed.

Check failure on line 179 in library/Graphite/Graphing/MetricsQuery.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Cannot access property $id on mixed.

Check failure on line 179 in library/Graphite/Graphing/MetricsQuery.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Cannot access property $id on mixed.

Check failure on line 179 in library/Graphite/Graphing/MetricsQuery.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Cannot access property $id on mixed.

Check failure on line 179 in library/Graphite/Graphing/MetricsQuery.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Cannot access property $id on mixed.

Check failure on line 179 in library/Graphite/Graphing/MetricsQuery.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Cannot access property $id on mixed.

Check failure on line 179 in library/Graphite/Graphing/MetricsQuery.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Cannot access property $id on mixed.
}

natsort($results);

IPT::recordf('Fetched %s metric(s) from %s', count($results), (string) $client->completeUrl($url));

return array_values($res->results);
return array_values($results);
}

public function fetchOne()
Expand Down
Loading