From 390956d317d541730393153eb00bd58e8983be3f Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Wed, 30 Mar 2022 19:16:22 +0200 Subject: [PATCH] Log gomaxprocs messages (#10506) Signed-off-by: Julien Pivotto --- cmd/prometheus/main.go | 7 +++++-- docs/feature_flags.md | 5 +---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/prometheus/main.go b/cmd/prometheus/main.go index a7386b01c..c0848c766 100644 --- a/cmd/prometheus/main.go +++ b/cmd/prometheus/main.go @@ -570,8 +570,11 @@ func main() { ) if cfg.enableAutoGOMAXPROCS { - if _, err := maxprocs.Set(); err != nil { - level.Warn(logger).Log("msg", "Failed to set GOMAXPROCS automatically", "err", err) + l := func(format string, a ...interface{}) { + level.Info(logger).Log("component", "automaxprocs", "msg", fmt.Sprintf(strings.TrimPrefix(format, "maxprocs: "), a...)) + } + if _, err := maxprocs.Set(maxprocs.Logger(l)); err != nil { + level.Warn(logger).Log("component", "automaxprocs", "msg", "Failed to set GOMAXPROCS automatically", "err", err) } } diff --git a/docs/feature_flags.md b/docs/feature_flags.md index f02be1be9..dfeaeb0dd 100644 --- a/docs/feature_flags.md +++ b/docs/feature_flags.md @@ -93,7 +93,4 @@ computed at all. `--enable-feature=auto-gomaxprocs` -When enabled, GOMAXPROCS variable will be automatically set to match the container CPU limit. - -This means that Go runtime will operate as if it had only amount of CPU specified in the container -CPU limit and not all CPUs on server where it's running. +When enabled, GOMAXPROCS variable is automatically set to match Linux container CPU quota.