mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2026-08-31 00:47:15 +02:00
feat: default to average downsampling
Average consolidation makes every plotted point the true arithmetic mean of its interval, which is what the Ganglia-style plot appearance depends on. LTTB deliberately keeps extremes instead, so a plot downsampled with it cannot be read as interval means. resolveResampleAlgo used to return an empty string when neither the user nor the config had chosen an algorithm, and cc-lib's GetResampler maps that to LTTB. Route every fallback through config.ResampleAlgo() and ship "average" as the generated and example default. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -25,7 +25,7 @@ const configString = `
|
|||||||
"short-running-jobs-duration": 300,
|
"short-running-jobs-duration": 300,
|
||||||
"resampling": {
|
"resampling": {
|
||||||
"default-policy": "medium",
|
"default-policy": "medium",
|
||||||
"default-algo": "lttb"
|
"default-algo": "average"
|
||||||
},
|
},
|
||||||
"api-allowed-ips": [
|
"api-allowed-ips": [
|
||||||
"*"
|
"*"
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
},
|
},
|
||||||
"resampling": {
|
"resampling": {
|
||||||
"default-policy": "medium",
|
"default-policy": "medium",
|
||||||
"default-algo": "lttb"
|
"default-algo": "average"
|
||||||
},
|
},
|
||||||
"footer-links": {
|
"footer-links": {
|
||||||
"imprint": "/imprint",
|
"imprint": "/imprint",
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ var configSchema = `
|
|||||||
"enum": ["low", "medium", "high"]
|
"enum": ["low", "medium", "high"]
|
||||||
},
|
},
|
||||||
"default-algo": {
|
"default-algo": {
|
||||||
"description": "Default resample algorithm when no user preference is set.",
|
"description": "Default resample algorithm when no user preference is set. Default and recommended: 'average' (RRDTool-style interval averaging).",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["lttb", "average", "simple"]
|
"enum": ["lttb", "average", "simple"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,12 +63,12 @@ func resolveResampleAlgo(ctx context.Context, resampleAlgo *model.ResampleAlgo)
|
|||||||
|
|
||||||
user := repository.GetUserFromContext(ctx)
|
user := repository.GetUserFromContext(ctx)
|
||||||
if user == nil {
|
if user == nil {
|
||||||
return ""
|
return config.ResampleAlgo()
|
||||||
}
|
}
|
||||||
|
|
||||||
conf, err := repository.GetUserCfgRepo().GetUIConfig(user)
|
conf, err := repository.GetUserCfgRepo().GetUIConfig(user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ""
|
return config.ResampleAlgo()
|
||||||
}
|
}
|
||||||
|
|
||||||
algoVal, ok := conf["plotConfiguration_resampleAlgo"]
|
algoVal, ok := conf["plotConfiguration_resampleAlgo"]
|
||||||
@@ -78,12 +78,8 @@ func resolveResampleAlgo(ctx context.Context, resampleAlgo *model.ResampleAlgo)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fall back to global default algo
|
// Fall back to the global default algo
|
||||||
if config.Keys.EnableResampling != nil && config.Keys.EnableResampling.DefaultAlgo != "" {
|
return config.ResampleAlgo()
|
||||||
return config.Keys.EnableResampling.DefaultAlgo
|
|
||||||
}
|
|
||||||
|
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// resolveResolutionFromDefaultPolicy computes a resolution using the global
|
// resolveResolutionFromDefaultPolicy computes a resolution using the global
|
||||||
|
|||||||
@@ -301,7 +301,10 @@
|
|||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
<div id="resampleAlgoHelp" class="form-text">
|
<div id="resampleAlgoHelp" class="form-text">
|
||||||
Algorithm used when downsampling time-series data. LTTB preserves visual shape, Average smooths data, Simple picks every Nth point.
|
Algorithm used when downsampling time-series data. Average (the
|
||||||
|
default) makes every plotted point the true mean of its interval,
|
||||||
|
LTTB preserves visual shape by keeping extremes, Simple picks every
|
||||||
|
Nth point.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Button color="primary" type="submit">Submit</Button>
|
<Button color="primary" type="submit">Submit</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user