-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from Icinga/metric-graphs-for-workloads
Add metric charts for workloads
- Loading branch information
Showing
8 changed files
with
360 additions
and
248 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
/* Icinga for Kubernetes Web | (c) 2024 Icinga GmbH | GPLv2 */ | ||
|
||
namespace Icinga\Module\Kubernetes\Web; | ||
|
||
use Icinga\Module\Kubernetes\Common\Metrics; | ||
use ipl\Html\BaseHtmlElement; | ||
|
||
class DetailMetricCharts extends BaseHtmlElement | ||
{ | ||
protected $metrics; | ||
|
||
protected $tag = 'section'; | ||
|
||
public function __construct(array $metrics) | ||
{ | ||
$this->metrics = $metrics; | ||
} | ||
|
||
protected function assemble(): void | ||
{ | ||
$metricRow = []; | ||
if (isset($this->metrics[Metrics::NODE_CPU_USAGE])) { | ||
$metricRow[] = new LineChart( | ||
'chart-medium', | ||
implode(', ', $this->metrics[Metrics::NODE_CPU_USAGE]), | ||
implode(', ', array_keys($this->metrics[Metrics::NODE_CPU_USAGE])), | ||
'CPU Usage', | ||
Metrics::COLOR_CPU | ||
); | ||
} | ||
if (isset($this->metrics[Metrics::NODE_MEMORY_USAGE])) { | ||
$metricRow[] = new LineChart( | ||
'chart-medium', | ||
implode(', ', $this->metrics[Metrics::NODE_MEMORY_USAGE]), | ||
implode(', ', array_keys($this->metrics[Metrics::NODE_MEMORY_USAGE])), | ||
'Memory Usage', | ||
Metrics::COLOR_MEMORY | ||
); | ||
} | ||
|
||
$this->addHtml(new MetricCharts($metricRow)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters