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
|
// 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
|
// 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.
|
// 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 _, scopes := range jd {
|
||||||
for _, jm := range scopes {
|
for _, jm := range scopes {
|
||||||
if jm.StatisticsSeries != nil || len(jm.Series) <= maxSeriesSize {
|
if jm.StatisticsSeries != nil || len(jm.Series) < maxSeriesSize {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -229,7 +229,7 @@
|
|||||||
timestep={metric.data.metric.timestep}
|
timestep={metric.data.metric.timestep}
|
||||||
scope={metric.data.scope}
|
scope={metric.data.scope}
|
||||||
series={metric.data.metric.series}
|
series={metric.data.metric.series}
|
||||||
statisticsSeries={metric.data.metric.statisticsSeries}
|
statisticsSeries={metric.data.metric?.statisticsSeries}
|
||||||
metric={metric.data.name}
|
metric={metric.data.name}
|
||||||
cluster={clusterInfos.find((c) => c.name == job.cluster)}
|
cluster={clusterInfos.find((c) => c.name == job.cluster)}
|
||||||
subCluster={job.subCluster}
|
subCluster={job.subCluster}
|
||||||
|
|||||||
@@ -236,7 +236,7 @@
|
|||||||
|
|
||||||
// conditional hide series color markers:
|
// conditional hide series color markers:
|
||||||
if (
|
if (
|
||||||
// useStatsSeries || // Min/Max/Median Self-Explanatory
|
// Min/Max/Median Self-Explanatory
|
||||||
dataSize === 1 || // Only one Y-Dataseries
|
dataSize === 1 || // Only one Y-Dataseries
|
||||||
dataSize > 8 // More than 8 Y-Dataseries
|
dataSize > 8 // More than 8 Y-Dataseries
|
||||||
) {
|
) {
|
||||||
@@ -273,7 +273,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dataSize <= 12 ) { // || useStatsSeries) {
|
if (dataSize <= 12 ) {
|
||||||
return {
|
return {
|
||||||
hooks: {
|
hooks: {
|
||||||
init: init,
|
init: init,
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
- `height Number?`: The plot height [Default: 300]
|
- `height Number?`: The plot height [Default: 300]
|
||||||
- `timestep Number`: The timestep used for X-axis rendering
|
- `timestep Number`: The timestep used for X-axis rendering
|
||||||
- `series [GraphQL.Series]`: The metric data object
|
- `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]
|
- `statisticsSeries [GraphQL.StatisticsSeries]?`: Min/Max/Median representation of metric data [Default: null]
|
||||||
- `cluster String?`: Cluster name of the parent job / data [Default: ""]
|
- `cluster String?`: Cluster name of the parent job / data [Default: ""]
|
||||||
- `subCluster String`: Name of the subCluster of the parent job
|
- `subCluster String`: Name of the subCluster of the parent job
|
||||||
@@ -37,7 +36,6 @@
|
|||||||
height = 300,
|
height = 300,
|
||||||
timestep,
|
timestep,
|
||||||
series,
|
series,
|
||||||
useStatsSeries = false,
|
|
||||||
statisticsSeries = null,
|
statisticsSeries = null,
|
||||||
cluster = "",
|
cluster = "",
|
||||||
subCluster,
|
subCluster,
|
||||||
@@ -78,6 +76,7 @@
|
|||||||
const resampleTrigger = $derived(resampleConfig?.trigger ? Number(resampleConfig.trigger) : null);
|
const resampleTrigger = $derived(resampleConfig?.trigger ? Number(resampleConfig.trigger) : null);
|
||||||
const resampleResolutions = $derived(resampleConfig?.resolutions ? [...resampleConfig.resolutions] : null);
|
const resampleResolutions = $derived(resampleConfig?.resolutions ? [...resampleConfig.resolutions] : null);
|
||||||
const resampleMinimum = $derived(resampleConfig?.resolutions ? Math.min(...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(
|
const thresholds = $derived(findJobAggregationThresholds(
|
||||||
subClusterTopology,
|
subClusterTopology,
|
||||||
metricConfig,
|
metricConfig,
|
||||||
@@ -243,11 +242,6 @@
|
|||||||
return pendingSeries;
|
return pendingSeries;
|
||||||
})
|
})
|
||||||
|
|
||||||
/* Effects */
|
|
||||||
$effect(() => {
|
|
||||||
if (!useStatsSeries && statisticsSeries != null) useStatsSeries = true;
|
|
||||||
})
|
|
||||||
|
|
||||||
// This updates plot on all size changes if wrapper (== data) exists
|
// This updates plot on all size changes if wrapper (== data) exists
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
if (plotWrapper) {
|
if (plotWrapper) {
|
||||||
|
|||||||
@@ -197,7 +197,6 @@
|
|||||||
{zoomState}
|
{zoomState}
|
||||||
{thresholdState}
|
{thresholdState}
|
||||||
statisticsSeries={statsSeries[selectedScopeIndex]}
|
statisticsSeries={statsSeries[selectedScopeIndex]}
|
||||||
useStatsSeries={!!statsSeries[selectedScopeIndex]}
|
|
||||||
enableFlip
|
enableFlip
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -174,7 +174,7 @@
|
|||||||
<p>No dataset(s) returned for <b>{selectedMetrics[i]}</b></p>
|
<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>
|
<p class="mb-1">Metric or host was not found in metric store for cluster <b>{cluster}</b>.</p>
|
||||||
</Card>
|
</Card>
|
||||||
{:else if !!metricData.data?.metric.statisticsSeries}
|
{:else if !!metricData?.data?.metric?.statisticsSeries}
|
||||||
<!-- "No Data"-Warning included in MetricPlot-Component -->
|
<!-- "No Data"-Warning included in MetricPlot-Component -->
|
||||||
<MetricPlot
|
<MetricPlot
|
||||||
{cluster}
|
{cluster}
|
||||||
@@ -183,8 +183,7 @@
|
|||||||
scope={metricData.data.scope}
|
scope={metricData.data.scope}
|
||||||
timestep={metricData.data.metric.timestep}
|
timestep={metricData.data.metric.timestep}
|
||||||
series={metricData.data.metric.series}
|
series={metricData.data.metric.series}
|
||||||
statisticsSeries={metricData.data?.metric.statisticsSeries}
|
statisticsSeries={metricData.data.metric.statisticsSeries}
|
||||||
useStatsSeries={!!metricData.data?.metric.statisticsSeries}
|
|
||||||
height={175}
|
height={175}
|
||||||
{plotSync}
|
{plotSync}
|
||||||
forNode
|
forNode
|
||||||
|
|||||||
Reference in New Issue
Block a user