From bf66594e143b12c3158558b670701182a7789696 Mon Sep 17 00:00:00 2001 From: matt durham Date: Wed, 3 Jul 2024 09:17:28 -0400 Subject: [PATCH 1/9] update automatically settting gomemlimit --- CHANGELOG.md | 4 ++++ internal/alloycli/cmd_run.go | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94f7394a92..dd781f2fa9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,11 +17,15 @@ Main (unreleased) ### Enhancements - Added a success rate panel on the Prometheus Components dashboard. (@thampiotr) + - Add namespace field to Faro payload (@cedricziel) +- Graduate automatically setting GOMEMLIMIT to Generally Available from Public Preview. (@mattdurham) + ### Bugfixes - Fixed an issue with `loki.source.kubernetes_events` not starting in large clusters due to short informer sync timeout. (@nrwiersma) + - Updated [ckit](https://github.com/grafana/ckit) to fix an issue with armv7 panic on startup when forming a cluster. (@imavroukakis) v1.2.0 diff --git a/internal/alloycli/cmd_run.go b/internal/alloycli/cmd_run.go index 63f40c94af..a6f266755f 100644 --- a/internal/alloycli/cmd_run.go +++ b/internal/alloycli/cmd_run.go @@ -197,9 +197,7 @@ func (fr *alloyRun) Run(configPath string) error { // Set the memory limit, this will honor GOMEMLIMIT if set // If there is a cgroup will follow that - if fr.minStability.Permits(featuregate.StabilityPublicPreview) { - memlimit.SetGoMemLimitWithOpts(memlimit.WithLogger(slog.New(l.Handler()))) - } + memlimit.SetGoMemLimitWithOpts(memlimit.WithLogger(slog.New(l.Handler()))) // Enable the profiling. setMutexBlockProfiling(l) From 0fb2507d769f0c2f39c263c62897d1a7eae6782c Mon Sep 17 00:00:00 2001 From: matt durham Date: Wed, 3 Jul 2024 09:40:30 -0400 Subject: [PATCH 2/9] update doc --- docs/sources/reference/cli/run.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/sources/reference/cli/run.md b/docs/sources/reference/cli/run.md index 57b5df86a8..7af7cfbee9 100644 --- a/docs/sources/reference/cli/run.md +++ b/docs/sources/reference/cli/run.md @@ -164,6 +164,12 @@ original configuration. Include `--config.extra-args` to pass additional command line flags from the original format to the converter. Refer to [alloy convert][] for more details on how `extra-args` work. +## Automatic setting of GOMEMLIMIT + +The `GOMEMLIMIT` variable will be automatically set if {{< param "PRODUCT_NAME" >}} can determine the appropriate value. If the `GOMEMLIMIT` value is set before running {{< param "PRODUCT_NAME" >}} then that setting will be honored. The value will be set to 90% of the cgroup value set. + +This is most commonly set through Kubernetes memory limits. + [alloy convert]: ../convert/ [clustering]: ../../../concepts/clustering/ From 919cb3a65ff6e8b22052c6d3d8b3cab1e7e77401 Mon Sep 17 00:00:00 2001 From: matt durham Date: Thu, 11 Jul 2024 10:41:35 -0400 Subject: [PATCH 3/9] Update changelog for v1.2.1. --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba82561a57..41f05343d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,11 @@ Main (unreleased) - Updated [ckit](https://github.com/grafana/ckit) to fix an issue with armv7 panic on startup when forming a cluster. (@imavroukakis) +v1.2.1 +----------------- + +### Bugfixes + - Fixed a clustering mode issue where a failure to perform static peers discovery did not result in a fatal failure at startup and could lead to potential split-brain issues. (@thampiotr) @@ -40,6 +45,7 @@ Main (unreleased) - Use Go 1.22.5 for builds. (@mattdurham) + v1.2.0 ----------------- From 52af0a275b31e57c482b3a4b00a6e281b3b3599b Mon Sep 17 00:00:00 2001 From: matt durham Date: Mon, 15 Jul 2024 15:12:49 -0400 Subject: [PATCH 4/9] Update docs --- docs/sources/reference/cli/environment-variables.md | 9 +++++++++ docs/sources/reference/cli/run.md | 7 ------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/sources/reference/cli/environment-variables.md b/docs/sources/reference/cli/environment-variables.md index a7d80f8d04..009871cfe5 100644 --- a/docs/sources/reference/cli/environment-variables.md +++ b/docs/sources/reference/cli/environment-variables.md @@ -14,6 +14,7 @@ The following environment variables are supported: * `GODEBUG` * `HTTP_PROXY` +* `GOMEMLIMIT` Refer to the [Go runtime][runtime] documentation for more information about Go runtime environment variables. @@ -35,4 +36,12 @@ Argument | Description | D ---------------------------|-------------------------------------------------|-------- `http://proxy.example.com` | The hostname or IP address of the proxy server. | +### GOMEMLIMIT + +Normally the [Go runtime][runtime] will release memory back to the Operating System when requested. In certain environments this may cause issues such as Out of Memory errors. The `GOMEMLIMIT` variable is a numeric value in bytes with an optional unit suffix. The supported suffixes include B, KiB, MiB, GiB, and TiB. This should not be treated has a hard limit. The process can use more memory if that memory is required. A rough number is to set `GOMEMLIMIT` to 90% of the maximum amount of memory usage. For example if you wanted to keep memory usage below `10GiB` then use `GOMEMLIMIT=8GiB`. + +#### Automatic setting of GOMEMLIMIT + +The `GOMEMLIMIT` variable will be automatically set if {{< param "PRODUCT_NAME" >}} can determine the appropriate value. If the `GOMEMLIMIT` value is set before running {{< param "PRODUCT_NAME" >}} then that setting will be honored. The value will be set to 90% of the cgroup value set. If the limit cannot be determined and no value was explicitly passed then no changes will occur. + [runtime]: https://pkg.go.dev/runtime diff --git a/docs/sources/reference/cli/run.md b/docs/sources/reference/cli/run.md index 2c4a15f48f..9e4afd1960 100644 --- a/docs/sources/reference/cli/run.md +++ b/docs/sources/reference/cli/run.md @@ -165,13 +165,6 @@ original configuration. Include `--config.extra-args` to pass additional command line flags from the original format to the converter. Refer to [alloy convert][] for more details on how `extra-args` work. -## Automatic setting of GOMEMLIMIT - -The `GOMEMLIMIT` variable will be automatically set if {{< param "PRODUCT_NAME" >}} can determine the appropriate value. If the `GOMEMLIMIT` value is set before running {{< param "PRODUCT_NAME" >}} then that setting will be honored. The value will be set to 90% of the cgroup value set. - -This is most commonly set through Kubernetes memory limits. - - [alloy convert]: ../convert/ [clustering]: ../../../concepts/clustering/ [go-discover]: https://github.com/hashicorp/go-discover From 62bd98f9f1ca2d190a5932d798be803eae4f75c4 Mon Sep 17 00:00:00 2001 From: mattdurham Date: Tue, 16 Jul 2024 08:37:45 -0400 Subject: [PATCH 5/9] Update docs/sources/reference/cli/environment-variables.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> --- docs/sources/reference/cli/environment-variables.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/sources/reference/cli/environment-variables.md b/docs/sources/reference/cli/environment-variables.md index 009871cfe5..881ab02733 100644 --- a/docs/sources/reference/cli/environment-variables.md +++ b/docs/sources/reference/cli/environment-variables.md @@ -38,7 +38,15 @@ Argument | Description | D ### GOMEMLIMIT -Normally the [Go runtime][runtime] will release memory back to the Operating System when requested. In certain environments this may cause issues such as Out of Memory errors. The `GOMEMLIMIT` variable is a numeric value in bytes with an optional unit suffix. The supported suffixes include B, KiB, MiB, GiB, and TiB. This should not be treated has a hard limit. The process can use more memory if that memory is required. A rough number is to set `GOMEMLIMIT` to 90% of the maximum amount of memory usage. For example if you wanted to keep memory usage below `10GiB` then use `GOMEMLIMIT=8GiB`. +Usually, the [Go runtime][runtime] will release memory back to the operating system when requested. +In some environments, this may cause issues such as Out Of Memory (OOM) errors. +You can use the `GOMEMLIMIT` environment variable to set a soft memory cap and limit the maximum memory {{< param "PRODUCT_NAME" >}} can use. +You can set `GOMEMLIMIT` to a numeric value in bytes with an optional unit suffix. +The supported unit suffixes are `B`, `KiB`, `MiB`, `GiB`, and `TiB`. +Don't treat the `GOMEMLIMIT` environment variable as a hard memory limit. +{{< param "PRODUCT_NAME" >}} processes can use more memory if that memory is required. +A rough number is to set `GOMEMLIMIT` to is 90% of the maximum memory required. +For example, if you want to keep memory usage below `10GiB`, use `GOMEMLIMIT=8GiB`. #### Automatic setting of GOMEMLIMIT From fc9ea6edcf0fe52d89321a53cb978b0abc1e1263 Mon Sep 17 00:00:00 2001 From: mattdurham Date: Tue, 16 Jul 2024 08:56:49 -0400 Subject: [PATCH 6/9] Update docs/sources/reference/cli/environment-variables.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> --- docs/sources/reference/cli/environment-variables.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/sources/reference/cli/environment-variables.md b/docs/sources/reference/cli/environment-variables.md index 881ab02733..8ed9396858 100644 --- a/docs/sources/reference/cli/environment-variables.md +++ b/docs/sources/reference/cli/environment-variables.md @@ -50,6 +50,9 @@ For example, if you want to keep memory usage below `10GiB`, use `GOMEMLIMIT=8Gi #### Automatic setting of GOMEMLIMIT -The `GOMEMLIMIT` variable will be automatically set if {{< param "PRODUCT_NAME" >}} can determine the appropriate value. If the `GOMEMLIMIT` value is set before running {{< param "PRODUCT_NAME" >}} then that setting will be honored. The value will be set to 90% of the cgroup value set. If the limit cannot be determined and no value was explicitly passed then no changes will occur. +The `GOMEMLIMIT` environment variable is set automatically {{< param "PRODUCT_NAME" >}} can determine the appropriate value. +If you set the `GOMEMLIMIT` environment variable before you run {{< param "PRODUCT_NAME" >}} then that setting will be used. +The variable value is set to 90% of the `cgroup` value set. +No changes will occur if the limit cannot be determined and you did not explicitly define a `GOMEMLIMIT` value. [runtime]: https://pkg.go.dev/runtime From cf0a568098080f351f7f5efe5b75c23f2a91dec4 Mon Sep 17 00:00:00 2001 From: mattdurham Date: Thu, 18 Jul 2024 14:22:04 -0400 Subject: [PATCH 7/9] Update docs/sources/reference/cli/environment-variables.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> --- docs/sources/reference/cli/environment-variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/reference/cli/environment-variables.md b/docs/sources/reference/cli/environment-variables.md index 8ed9396858..093bb1cfaf 100644 --- a/docs/sources/reference/cli/environment-variables.md +++ b/docs/sources/reference/cli/environment-variables.md @@ -48,7 +48,7 @@ Don't treat the `GOMEMLIMIT` environment variable as a hard memory limit. A rough number is to set `GOMEMLIMIT` to is 90% of the maximum memory required. For example, if you want to keep memory usage below `10GiB`, use `GOMEMLIMIT=8GiB`. -#### Automatic setting of GOMEMLIMIT +#### Automatically set GOMEMLIMIT The `GOMEMLIMIT` environment variable is set automatically {{< param "PRODUCT_NAME" >}} can determine the appropriate value. If you set the `GOMEMLIMIT` environment variable before you run {{< param "PRODUCT_NAME" >}} then that setting will be used. From 9d808e4a0dda5826330fb8175b6eb71b2e39d0d7 Mon Sep 17 00:00:00 2001 From: mattdurham Date: Thu, 18 Jul 2024 14:22:36 -0400 Subject: [PATCH 8/9] Update docs/sources/reference/cli/environment-variables.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> --- docs/sources/reference/cli/environment-variables.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/sources/reference/cli/environment-variables.md b/docs/sources/reference/cli/environment-variables.md index 093bb1cfaf..af22762eb1 100644 --- a/docs/sources/reference/cli/environment-variables.md +++ b/docs/sources/reference/cli/environment-variables.md @@ -50,9 +50,7 @@ For example, if you want to keep memory usage below `10GiB`, use `GOMEMLIMIT=8Gi #### Automatically set GOMEMLIMIT -The `GOMEMLIMIT` environment variable is set automatically {{< param "PRODUCT_NAME" >}} can determine the appropriate value. -If you set the `GOMEMLIMIT` environment variable before you run {{< param "PRODUCT_NAME" >}} then that setting will be used. -The variable value is set to 90% of the `cgroup` value set. +The `GOMEMLIMIT` environment variable is either automatically set to 90% of an available `cgroup` value, or you can explicitly set the `GOMEMLIMIT` environment variable before you run {{< param "PRODUCT_NAME" >}}. No changes will occur if the limit cannot be determined and you did not explicitly define a `GOMEMLIMIT` value. [runtime]: https://pkg.go.dev/runtime From 215f3b3e12cca63045841d22aba68aa137f426d9 Mon Sep 17 00:00:00 2001 From: matt durham Date: Thu, 17 Oct 2024 14:44:11 -0400 Subject: [PATCH 9/9] fix typo --- docs/sources/reference/cli/environment-variables.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/sources/reference/cli/environment-variables.md b/docs/sources/reference/cli/environment-variables.md index 24f31d92fa..094c4d89bf 100644 --- a/docs/sources/reference/cli/environment-variables.md +++ b/docs/sources/reference/cli/environment-variables.md @@ -25,11 +25,11 @@ Refer to the [Go runtime][runtime] documentation for more information about Go r You can use the `GODEBUG` environment variable to control the debugging variables within the Go runtime. The following arguments are supported. -Argument | Description | Default ---------------------------------|------------------------------------------------------------------------------------------------------|-------- -`x509usefallbackroots` | Enforce a fallback on the X.509 trusted root certificates. Set to `1` to enable. | `0` -`netdns` | Force a resolver. Set to `go` for a pure Go resolver. Set to `cgo` or `win32` for a native resolver. | -`netdns` | Show resolver debugging information. Set to `1` for basic information. Set to `2` for verbose. | + Argument | Description | Default +------------------------|------------------------------------------------------------------------------------------------------|--------- + `x509usefallbackroots` | Enforce a fallback on the X.509 trusted root certificates. Set to `1` to enable. | `0` + `netdns` | Force a resolver. Set to `go` for a pure Go resolver. Set to `cgo` or `win32` for a native resolver. | + `netdns` | Show resolver debugging information. Set to `1` for basic information. Set to `2` for verbose. | ## HTTP_PROXY @@ -57,7 +57,7 @@ The supported unit suffixes are `B`, `KiB`, `MiB`, `GiB`, and `TiB`. Don't treat the `GOMEMLIMIT` environment variable as a hard memory limit. {{< param "PRODUCT_NAME" >}} processes can use more memory if that memory is required. A rough number is to set `GOMEMLIMIT` to is 90% of the maximum memory required. -For example, if you want to keep memory usage below `10GiB`, use `GOMEMLIMIT=8GiB`. +For example, if you want to keep memory usage below `10GiB`, use `GOMEMLIMIT=9GiB`. #### Automatically set GOMEMLIMIT