Add sum and average to host metrics
This commit is contained in:
@@ -158,13 +158,9 @@ const load_metrics = async (window: number, interval: number) => {
|
||||
for (const host of Object.keys(metrics.metrics[graph.agg_base])) {
|
||||
metrics.metrics[graph.metric][host] = []
|
||||
for (let i = 0; i < metrics.metrics[graph.agg_base][host].length; i++) {
|
||||
if (metrics.metrics[graph.agg_divisor][host][i] > 0) {
|
||||
metrics.metrics[graph.metric][host].push(
|
||||
metrics.metrics[graph.agg_base][host][i] / metrics.metrics[graph.agg_divisor][host][i]
|
||||
)
|
||||
} else {
|
||||
metrics.metrics[graph.metric][host].push(0)
|
||||
}
|
||||
metrics.metrics[graph.metric][host].push(
|
||||
metrics.metrics[graph.agg_base][host][i] / Math.max(metrics.metrics[graph.agg_divisor][host][i], 1)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -204,7 +200,7 @@ onDestroy(() => {
|
||||
<button onclick={() => setWindow(1051200, 1440)}>Two Years 1d</button>
|
||||
<button onclick={() => setWindow(2628000, 1440)}>Five Years 1d</button>
|
||||
<br/>
|
||||
<ToggleButton bind:on={showAggregate}>Aggregate</ToggleButton>
|
||||
<ToggleButton bind:on={showAggregate}>Sum and Average</ToggleButton>
|
||||
</div>
|
||||
|
||||
{#each groups as group (group.title)}
|
||||
@@ -236,6 +232,6 @@ onDestroy(() => {
|
||||
}
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
|
||||
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user