mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2026-03-20 23:07:29 +01:00
streamline and unify statsSeries calc and render
This commit is contained in:
@@ -192,10 +192,10 @@ func LoadData(job *schema.Job,
|
||||
// Generate statistics series for jobs with many nodes to enable min/median/max graphs
|
||||
// instead of overwhelming the UI with individual node lines. Note that newly calculated
|
||||
// statistics use min/median/max, while archived statistics may use min/mean/max.
|
||||
const maxSeriesSize int = 15
|
||||
const maxSeriesSize int = 8
|
||||
for _, scopes := range jd {
|
||||
for _, jm := range scopes {
|
||||
if jm.StatisticsSeries != nil || len(jm.Series) <= maxSeriesSize {
|
||||
if jm.StatisticsSeries != nil || len(jm.Series) < maxSeriesSize {
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@
|
||||
timestep={metric.data.metric.timestep}
|
||||
scope={metric.data.scope}
|
||||
series={metric.data.metric.series}
|
||||
statisticsSeries={metric.data.metric.statisticsSeries}
|
||||
statisticsSeries={metric.data.metric?.statisticsSeries}
|
||||
metric={metric.data.name}
|
||||
cluster={clusterInfos.find((c) => c.name == job.cluster)}
|
||||
subCluster={job.subCluster}
|
||||
|
||||
@@ -236,7 +236,7 @@
|
||||
|
||||
// conditional hide series color markers:
|
||||
if (
|
||||
// useStatsSeries || // Min/Max/Median Self-Explanatory
|
||||
// Min/Max/Median Self-Explanatory
|
||||
dataSize === 1 || // Only one Y-Dataseries
|
||||
dataSize > 8 // More than 8 Y-Dataseries
|
||||
) {
|
||||
@@ -273,7 +273,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (dataSize <= 12 ) { // || useStatsSeries) {
|
||||
if (dataSize <= 12 ) {
|
||||
return {
|
||||
hooks: {
|
||||
init: init,
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
- `height Number?`: The plot height [Default: 300]
|
||||
- `timestep Number`: The timestep used for X-axis rendering
|
||||
- `series [GraphQL.Series]`: The metric data object
|
||||
- `useStatsSeries Bool?`: If this plot uses the statistics Min/Max/Median representation; automatically set to according bool [Default: false]
|
||||
- `statisticsSeries [GraphQL.StatisticsSeries]?`: Min/Max/Median representation of metric data [Default: null]
|
||||
- `cluster String?`: Cluster name of the parent job / data [Default: ""]
|
||||
- `subCluster String`: Name of the subCluster of the parent job
|
||||
@@ -37,7 +36,6 @@
|
||||
height = 300,
|
||||
timestep,
|
||||
series,
|
||||
useStatsSeries = false,
|
||||
statisticsSeries = null,
|
||||
cluster = "",
|
||||
subCluster,
|
||||
@@ -78,6 +76,7 @@
|
||||
const resampleTrigger = $derived(resampleConfig?.trigger ? Number(resampleConfig.trigger) : null);
|
||||
const resampleResolutions = $derived(resampleConfig?.resolutions ? [...resampleConfig.resolutions] : null);
|
||||
const resampleMinimum = $derived(resampleConfig?.resolutions ? Math.min(...resampleConfig.resolutions) : null);
|
||||
const useStatsSeries = $derived(!!statisticsSeries); // Display Stats Series By Default if Exists
|
||||
const thresholds = $derived(findJobAggregationThresholds(
|
||||
subClusterTopology,
|
||||
metricConfig,
|
||||
@@ -243,11 +242,6 @@
|
||||
return pendingSeries;
|
||||
})
|
||||
|
||||
/* Effects */
|
||||
$effect(() => {
|
||||
if (!useStatsSeries && statisticsSeries != null) useStatsSeries = true;
|
||||
})
|
||||
|
||||
// This updates plot on all size changes if wrapper (== data) exists
|
||||
$effect(() => {
|
||||
if (plotWrapper) {
|
||||
|
||||
@@ -197,7 +197,6 @@
|
||||
{zoomState}
|
||||
{thresholdState}
|
||||
statisticsSeries={statsSeries[selectedScopeIndex]}
|
||||
useStatsSeries={!!statsSeries[selectedScopeIndex]}
|
||||
enableFlip
|
||||
/>
|
||||
{/if}
|
||||
|
||||
@@ -174,7 +174,7 @@
|
||||
<p>No dataset(s) returned for <b>{selectedMetrics[i]}</b></p>
|
||||
<p class="mb-1">Metric or host was not found in metric store for cluster <b>{cluster}</b>.</p>
|
||||
</Card>
|
||||
{:else if !!metricData.data?.metric.statisticsSeries}
|
||||
{:else if !!metricData?.data?.metric?.statisticsSeries}
|
||||
<!-- "No Data"-Warning included in MetricPlot-Component -->
|
||||
<MetricPlot
|
||||
{cluster}
|
||||
@@ -183,8 +183,7 @@
|
||||
scope={metricData.data.scope}
|
||||
timestep={metricData.data.metric.timestep}
|
||||
series={metricData.data.metric.series}
|
||||
statisticsSeries={metricData.data?.metric.statisticsSeries}
|
||||
useStatsSeries={!!metricData.data?.metric.statisticsSeries}
|
||||
statisticsSeries={metricData.data.metric.statisticsSeries}
|
||||
height={175}
|
||||
{plotSync}
|
||||
forNode
|
||||
|
||||
Reference in New Issue
Block a user