From 690c9da81762bebb3bceebf8d332df6ac2417baa Mon Sep 17 00:00:00 2001 From: machine424 Date: Tue, 6 May 2025 17:41:07 +0200 Subject: [PATCH] chore(config): add guidelines for adding a new RuntimeConfig field based on learnings from GoGC addition Signed-off-by: machine424 --- config/config.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/config/config.go b/config/config.go index 17ece7a9b2..fcf30f6cad 100644 --- a/config/config.go +++ b/config/config.go @@ -656,6 +656,21 @@ const DefaultGoGCPercentage = 75 type RuntimeConfig struct { // The Go garbage collection target percentage. GoGC int `yaml:"gogc,omitempty"` + + // Below are guidelines for adding a new field: + // + // For config that shouldn't change after startup, you might want to use + // flags https://prometheus.io/docs/prometheus/latest/command-line/prometheus/. + // + // Consider when the new field is first applied: at the very beginning of instance + // startup, after the TSDB is loaded etc. See https://github.com/prometheus/prometheus/pull/16491 + // for an example. + // + // Provide a test covering various scenarios: empty config file, empty or incomplete runtime + // config block, precedence over other inputs (e.g., env vars, if applicable) etc. + // See TestRuntimeGOGCConfig (or https://github.com/prometheus/prometheus/pull/15238). + // The test should also verify behavior on reloads, since this config should be + // adjustable at runtime. } // isZero returns true iff the global config is the zero value.