From b3222f3523dfbedeb4e2704a860f232b68aaf9ff Mon Sep 17 00:00:00 2001 From: Christoph Kluge Date: Mon, 30 Sep 2024 18:31:49 +0200 Subject: [PATCH] fix: archived statisticsSeries with mean data now shown again --- internal/metricDataDispatcher/dataLoader.go | 4 +++- pkg/schema/metrics.go | 1 + web/frontend/src/Job.root.svelte | 1 + web/frontend/src/generic/joblist/JobListRow.svelte | 1 + web/frontend/src/generic/plots/MetricPlot.svelte | 12 ++++++++---- web/frontend/src/job/Metric.svelte | 1 + 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/internal/metricDataDispatcher/dataLoader.go b/internal/metricDataDispatcher/dataLoader.go index 121fbf4..1f2e175 100644 --- a/internal/metricDataDispatcher/dataLoader.go +++ b/internal/metricDataDispatcher/dataLoader.go @@ -139,11 +139,13 @@ func LoadData(job *schema.Job, } // FIXME: Review: Is this really necessary or correct. - // Note: Lines 142-170 formerly known as prepareJobData(jobData, scoeps) + // Note: Lines 147-170 formerly known as prepareJobData(jobData, scopes) // For /monitoring/job/ and some other places, flops_any and mem_bw need // to be available at the scope 'node'. If a job has a lot of nodes, // statisticsSeries should be available so that a min/median/max Graph can be // used instead of a lot of single lines. + // NOTE: New StatsSeries will always be calculated as 'min/median/max' + // Existing (archived) StatsSeries can be 'min/mean/max'! const maxSeriesSize int = 15 for _, scopes := range jd { for _, jm := range scopes { diff --git a/pkg/schema/metrics.go b/pkg/schema/metrics.go index 08636f1..9db853d 100644 --- a/pkg/schema/metrics.go +++ b/pkg/schema/metrics.go @@ -123,6 +123,7 @@ func (jd *JobData) Size() int { for _, metric := range scopes { if metric.StatisticsSeries != nil { n += len(metric.StatisticsSeries.Max) + n += len(metric.StatisticsSeries.Mean) n += len(metric.StatisticsSeries.Median) n += len(metric.StatisticsSeries.Min) } diff --git a/web/frontend/src/Job.root.svelte b/web/frontend/src/Job.root.svelte index 9601e9c..2827248 100644 --- a/web/frontend/src/Job.root.svelte +++ b/web/frontend/src/Job.root.svelte @@ -98,6 +98,7 @@ timestep statisticsSeries { min + mean median max } diff --git a/web/frontend/src/generic/joblist/JobListRow.svelte b/web/frontend/src/generic/joblist/JobListRow.svelte index b1e1511..f4cc71a 100644 --- a/web/frontend/src/generic/joblist/JobListRow.svelte +++ b/web/frontend/src/generic/joblist/JobListRow.svelte @@ -53,6 +53,7 @@ timestep statisticsSeries { min + mean median max } diff --git a/web/frontend/src/generic/plots/MetricPlot.svelte b/web/frontend/src/generic/plots/MetricPlot.svelte index 230e090..1c09150 100644 --- a/web/frontend/src/generic/plots/MetricPlot.svelte +++ b/web/frontend/src/generic/plots/MetricPlot.svelte @@ -133,8 +133,8 @@ export let zoomState = null; if (useStatsSeries == null) useStatsSeries = statisticsSeries != null; - if (useStatsSeries == false && series == null) useStatsSeries = true; + const usesMeanStatsSeries = (useStatsSeries && statisticsSeries.mean.length != 0) const dispatch = createEventDispatcher(); const subClusterTopology = getContext("getHardwareTopology")(cluster, subCluster); @@ -278,7 +278,7 @@ } const longestSeries = useStatsSeries - ? statisticsSeries.median.length + ? (usesMeanStatsSeries ? statisticsSeries.mean.length : statisticsSeries.median.length) : series.reduce((n, series) => Math.max(n, series.data.length), 0); const maxX = longestSeries * timestep; let maxY = null; @@ -327,7 +327,11 @@ if (useStatsSeries) { plotData.push(statisticsSeries.min); plotData.push(statisticsSeries.max); - plotData.push(statisticsSeries.median); + if (usesMeanStatsSeries) { + plotData.push(statisticsSeries.mean); + } else { + plotData.push(statisticsSeries.median); + } /* deprecated: sparse data handled by uplot */ // if (forNode === true) { @@ -426,7 +430,7 @@ // Draw plot type label: let textl = `${scope}${plotSeries.length > 2 ? "s" : ""}${ useStatsSeries - ? ": min/median/max" + ? (usesMeanStatsSeries ? ": min/mean/max" : ": min/median/max") : metricConfig != null && scope != metricConfig.scope ? ` (${metricConfig.aggregation})` : "" diff --git a/web/frontend/src/job/Metric.svelte b/web/frontend/src/job/Metric.svelte index 89b9d30..4b4c8d0 100644 --- a/web/frontend/src/job/Metric.svelte +++ b/web/frontend/src/job/Metric.svelte @@ -74,6 +74,7 @@ timestep statisticsSeries { min + mean median max }