From b0afe06ea8ed0a516e01426dbf45c85a8358134e Mon Sep 17 00:00:00 2001 From: Ben Ye Date: Sun, 17 Mar 2024 13:24:40 -0700 Subject: [PATCH 1/3] mark mem ballast flag as deprecated Signed-off-by: Ben Ye --- cmd/cortex/main.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/cmd/cortex/main.go b/cmd/cortex/main.go index b16ae526c8..ef035f6306 100644 --- a/cmd/cortex/main.go +++ b/cmd/cortex/main.go @@ -96,12 +96,14 @@ func main() { _ = flag.CommandLine.Bool(configExpandENV, false, "Expands ${var} or $var in config according to the values of the environment variables.") flag.IntVar(&eventSampleRate, "event.sample-rate", 0, "How often to sample observability events (0 = never).") - flag.IntVar(&ballastBytes, "mem-ballast-size-bytes", 0, "Size of memory ballast to allocate.") flag.IntVar(&mutexProfileFraction, "debug.mutex-profile-fraction", 0, "Fraction of mutex contention events that are reported in the mutex profile. On average 1/rate events are reported. 0 to disable.") flag.IntVar(&blockProfileRate, "debug.block-profile-rate", 0, "Fraction of goroutine blocking events that are reported in the blocking profile. 1 to include every blocking event in the profile, 0 to disable.") flag.BoolVar(&printVersion, "version", false, "Print Cortex version and exit.") flag.BoolVar(&printModules, "modules", false, "List available values that can be used as target.") + //lint:ignore faillint Need to pass the global logger like this for warning on deprecated methods + flagext.DeprecatedFlag(flag.CommandLine, "mem-ballast-size-bytes", "Deprecated: Setting this flag will not take any effect. Size of memory ballast to allocate", util_log.Logger) + usage := flag.CommandLine.Usage flag.CommandLine.Usage = func() { /* don't do anything by default, we will print usage ourselves, but only when requested. */ } flag.CommandLine.Init(flag.CommandLine.Name(), flag.ContinueOnError) @@ -151,10 +153,6 @@ func main() { } util_log.InitLogger(&cfg.Server) - - // Allocate a block of memory to alter GC behaviour. See https://github.com/golang/go/issues/23044 - ballast := make([]byte, ballastBytes) - util.InitEvents(eventSampleRate) ctx, cancelFn := context.WithCancel(context.Background()) @@ -203,7 +201,6 @@ func main() { err = t.Run() cancelFn() - runtime.KeepAlive(ballast) util_log.CheckFatal("running cortex", err) } From 5b918fa6c4f9a50c6d7fddbade6a102051072a3f Mon Sep 17 00:00:00 2001 From: Ben Ye Date: Sun, 17 Mar 2024 13:32:21 -0700 Subject: [PATCH 2/3] fix lint Signed-off-by: Ben Ye --- CHANGELOG.md | 1 + cmd/cortex/main.go | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ce378ed33..c3ded683b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * [CHANGE] Ingester: Disable uploading compacted blocks and overlapping compaction in ingester. #5735 * [CHANGE] Distributor: Count the number of rate-limited samples in `distributor_samples_in_total`. #5714 * [CHANGE] Ruler: Remove `cortex_ruler_write_requests_total`, `cortex_ruler_write_requests_failed_total`, `cortex_ruler_queries_total`, `cortex_ruler_queries_failed_total`, and `cortex_ruler_query_seconds_total` metrics for the tenant when the ruler deletes the manager for the tenant. #5772 +* [CHANGE] Main: Mark `mem-ballast-size-bytes` flag as deprecated. #5816 * [CHANGE] Querier: Mark `-querier.ingester-streaming` flag as deprecated. Now query ingester streaming is always enabled. #5817 * [FEATURE] Ingester: Add per-tenant new metric `cortex_ingester_tsdb_data_replay_duration_seconds`. #5477 * [FEATURE] Query Frontend/Scheduler: Add query priority support. #5605 diff --git a/cmd/cortex/main.go b/cmd/cortex/main.go index ef035f6306..d879b6d258 100644 --- a/cmd/cortex/main.go +++ b/cmd/cortex/main.go @@ -61,7 +61,6 @@ func main() { var ( cfg cortex.Config eventSampleRate int - ballastBytes int mutexProfileFraction int blockProfileRate int printVersion bool From 9e3e1be89deebd376ac806a477e9f436553bc432 Mon Sep 17 00:00:00 2001 From: Ben Ye Date: Mon, 18 Mar 2024 14:55:08 -0700 Subject: [PATCH 3/3] address comments Signed-off-by: Ben Ye --- cmd/cortex/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/cortex/main.go b/cmd/cortex/main.go index d879b6d258..ad0ff0fa08 100644 --- a/cmd/cortex/main.go +++ b/cmd/cortex/main.go @@ -101,7 +101,7 @@ func main() { flag.BoolVar(&printModules, "modules", false, "List available values that can be used as target.") //lint:ignore faillint Need to pass the global logger like this for warning on deprecated methods - flagext.DeprecatedFlag(flag.CommandLine, "mem-ballast-size-bytes", "Deprecated: Setting this flag will not take any effect. Size of memory ballast to allocate", util_log.Logger) + flagext.DeprecatedFlag(flag.CommandLine, "mem-ballast-size-bytes", "Deprecated: Setting this flag will not take any effect, for similar functionality use GOMEMLIMIT. Size of memory ballast to allocate", util_log.Logger) usage := flag.CommandLine.Usage flag.CommandLine.Usage = func() { /* don't do anything by default, we will print usage ourselves, but only when requested. */ }