You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: promote auto-gomemlimit to a regular flag (#5464)
change feature flag `auto-gomemlimit` to a regular flag `--auto-gomemlimit`
and add a new flag `--auto-gomemlimit.refresh-interval`.
The flag layout is identical to the one used in prometheus, except that
this feature is enabled by default in prometheus and disabled by default
in alertmanager.
Signed-off-by: Christoph Maser <christoph.maser+github@gmail.com>
Copy file name to clipboardExpand all lines: cmd/alertmanager/main.go
+13-2Lines changed: 13 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -66,8 +66,12 @@ func run() int {
66
66
getConcurrency=kingpin.Flag("web.get-concurrency", "Maximum number of GET requests processed concurrently. If negative or zero, the limit is GOMAXPROC or 8, whichever is larger.").Default("0").Int()
67
67
httpTimeout=kingpin.Flag("web.timeout", "Timeout for HTTP requests. If negative or zero, no timeout is set.").Default("0").Duration()
68
68
69
-
memlimitRatio=kingpin.Flag("auto-gomemlimit.ratio", "The ratio of reserved GOMEMLIMIT memory to the detected maximum container or system memory. The value must be greater than 0 and less than or equal to 1.").
69
+
memlimitEnable=kingpin.Flag("auto-gomemlimit", "Automatically set GOMEMLIMIT to match Linux container or system memory limit").
70
+
Default("false").Bool()
71
+
memlimitRatio=kingpin.Flag("auto-gomemlimit.ratio", "The ratio of reserved GOMEMLIMIT memory to the detected maximum container or system memory.").
70
72
Default("0.9").Float64()
73
+
memlimitRefreshInterval=kingpin.Flag("auto-gomemlimit.refresh-interval", "Interval at which to re-detect the container or system memory limit and update GOMEMLIMIT accordingly. Useful when the limit can change at runtime, e.g. with a Vertical Pod Autoscaler. Set to 0 to detect the limit only once at startup. Note that a downward change in the limit can cause a temporary increase in garbage collection activity. Only used when --auto-gomemlimit is set.").
74
+
Default("0s").Duration()
71
75
72
76
clusterBindAddr=kingpin.Flag("cluster.listen-address", "Listen address for cluster. Set to empty string to disable HA mode.").
73
77
Default(app.DefaultClusterAddr).String()
@@ -108,19 +112,26 @@ func run() int {
108
112
}
109
113
compat.InitFromFlags(logger, ff)
110
114
111
-
ifff.EnableAutoGOMEMLIMIT() {
115
+
if*memlimitEnable||ff.EnableAutoGOMEMLIMIT() {
112
116
if*memlimitRatio<=0.0||*memlimitRatio>1.0 {
113
117
logger.Error("--auto-gomemlimit.ratio must be greater than 0 and less than or equal to 1.")
114
118
return1
115
119
}
120
+
if*memlimitRefreshInterval<0 {
121
+
logger.Error("--auto-gomemlimit.refresh-interval must not be negative.")
0 commit comments