mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-12 23:54:01 +09:00
fix(observability-proxy): require a range and bucket count the step cap fits
The step is capped at a third of the maximum range so that vlselect's alignment to whole steps cannot widen the window past that range. With fewer than three buckets, or a range under three seconds, the minimum step exceeds that cap and the bound no longer holds, so such settings are refused at startup. Assisted-by: LLM Signed-off-by: ZverGuy <maximbel2003@gmail.com>
This commit is contained in:
1 parent
4e8071aa2b
commit
ca7f283b6a
2 files changed
+9
-3
No files matched your search
@@ -96,8 +96,12 @@ func parseFlags(args []string) (options, error) {
|
||||
return o, errors.New("--cluster-domain must not be empty")
|
||||
case o.logs.DefaultRange <= 0 || o.logs.MaxRange < o.logs.DefaultRange:
|
||||
return o, errors.New("--logs-default-range must be positive and not above --logs-max-range")
|
||||
case o.logs.MaxBuckets <= 0:
|
||||
return o, errors.New("--logs-max-buckets must be positive")
|
||||
// Below three buckets, or a range under three seconds, the step cap
|
||||
// that keeps vlselect's step alignment inside the range cannot hold.
|
||||
case o.logs.MaxBuckets < 3:
|
||||
return o, errors.New("--logs-max-buckets must be at least 3")
|
||||
case o.logs.MaxRange < 3*time.Second:
|
||||
return o, errors.New("--logs-max-range must be at least 3s")
|
||||
case o.logs.DefaultLimit <= 0 || o.logs.MaxLimit < o.logs.DefaultLimit:
|
||||
return o, errors.New("--logs-default-limit must be positive and not above --logs-max-limit")
|
||||
case o.logs.MaxTailResume < 0:
|
||||
|
||||
@@ -49,7 +49,9 @@ func TestParseFlagsInvalid(t *testing.T) {
|
||||
{"--root-tenant="},
|
||||
{"--cluster-domain="},
|
||||
{"--logs-default-range=48h", "--logs-max-range=24h"},
|
||||
{"--logs-max-buckets=0"},
|
||||
{"--logs-max-buckets=2"},
|
||||
{"--logs-max-range=2s", "--logs-default-range=1s"},
|
||||
{"--shutdown-timeout=-1s"},
|
||||
{"--logs-default-limit=0"},
|
||||
{"--logs-default-limit=100", "--logs-max-limit=10"},
|
||||
{"--logs-max-tail-resume=-1m"},
|
||||
|
||||
Reference in new issue
Block a user