Skip to content
This repository was archived by the owner on Apr 27, 2026. It is now read-only.
Open
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
20 changes: 17 additions & 3 deletions src/Command/Metrics/MetricsCommandBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,29 @@ protected function addMetricsOptions()
* Returns the resources overview URL for the selected environment.
*
* @param Environment $environment
* @return string|false The link data or false on failure
* @return string|false The resources overview URL, or false if not available
* @throws \GuzzleHttp\Exception\GuzzleException if there is an error in fetching observability metadata
*/
private function getResourcesOverviewUrl(Environment $environment)
{
if (!$environment->hasLink('#observability-pipeline')) {
$entrypointUrl = rtrim($environment->getUri(), '/') . '/observability/';

$client = $this->api()->getHttpClient();
$request = $client->createRequest('GET', $entrypointUrl);

try {
$response = $client->send($request);
} catch (BadResponseException $e) {
return false;
}
return rtrim($environment->getLink('#observability-pipeline'), '/') . '/resources/overview';

$data = json_decode($response->getBody()->__toString(), true);

if (empty($data['_links']['resources_overview']['href'])) {
return false;
}

return $data['_links']['resources_overview']['href'];
}

/**
Expand Down
Loading