-
Notifications
You must be signed in to change notification settings - Fork 9.7k
config: set gogc default value when config body is empty #16052
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
config: set gogc default value when config body is empty #16052
Conversation
Signed-off-by: Danial Eskandari <doneskandari@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this.
This should address the empty config file
case raised in the issue, but empty config file with GOGC env var set
still needs a fix. That will require moving some parts, we can take care of that in a another PR if you want.
(we can also add more tests to this gogc part)
…nfigBody` add GoGC assertion in `TestEmptyConfig`, also removed the no longer needed runtime config assignment in `TestEmptyGlobalBlock` Signed-off-by: Danial Eskandari <doneskandari@gmail.com>
ab90765
to
fe55698
Compare
…plicate assertions Signed-off-by: Danial Eskandari <doneskandari@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for this.
lgtm.
ok, let's have the other change in a follow-up and let's have more tests as well. Again you can fix/adjust and make use of the tests I have here #15238 if needed.
…16052) * fix: set gogc default value when config body is empty Signed-off-by: Danial Eskandari <doneskandari@gmail.com> * refactor: explicitly check value 75 in `TestGoGCDefaultValueOnEmptyConfigBody` add GoGC assertion in `TestEmptyConfig`, also removed the no longer needed runtime config assignment in `TestEmptyGlobalBlock` Signed-off-by: Danial Eskandari <doneskandari@gmail.com> * refactor: remove `TestGoGCDefaultValueOnEmptyConfigBody` to reduce duplicate assertions Signed-off-by: Danial Eskandari <doneskandari@gmail.com> --------- Signed-off-by: Danial Eskandari <doneskandari@gmail.com>
…16052) * fix: set gogc default value when config body is empty Signed-off-by: Danial Eskandari <doneskandari@gmail.com> * refactor: explicitly check value 75 in `TestGoGCDefaultValueOnEmptyConfigBody` add GoGC assertion in `TestEmptyConfig`, also removed the no longer needed runtime config assignment in `TestEmptyGlobalBlock` Signed-off-by: Danial Eskandari <doneskandari@gmail.com> * refactor: remove `TestGoGCDefaultValueOnEmptyConfigBody` to reduce duplicate assertions Signed-off-by: Danial Eskandari <doneskandari@gmail.com> --------- Signed-off-by: Danial Eskandari <doneskandari@gmail.com> Signed-off-by: machine424 <ayoubmrini424@gmail.com>
…16052) * fix: set gogc default value when config body is empty Signed-off-by: Danial Eskandari <doneskandari@gmail.com> * refactor: explicitly check value 75 in `TestGoGCDefaultValueOnEmptyConfigBody` add GoGC assertion in `TestEmptyConfig`, also removed the no longer needed runtime config assignment in `TestEmptyGlobalBlock` Signed-off-by: Danial Eskandari <doneskandari@gmail.com> * refactor: remove `TestGoGCDefaultValueOnEmptyConfigBody` to reduce duplicate assertions Signed-off-by: Danial Eskandari <doneskandari@gmail.com> --------- Signed-off-by: Danial Eskandari <doneskandari@gmail.com> Signed-off-by: machine424 <ayoubmrini424@gmail.com>
…16052) * fix: set gogc default value when config body is empty Signed-off-by: Danial Eskandari <doneskandari@gmail.com> * refactor: explicitly check value 75 in `TestGoGCDefaultValueOnEmptyConfigBody` add GoGC assertion in `TestEmptyConfig`, also removed the no longer needed runtime config assignment in `TestEmptyGlobalBlock` Signed-off-by: Danial Eskandari <doneskandari@gmail.com> * refactor: remove `TestGoGCDefaultValueOnEmptyConfigBody` to reduce duplicate assertions Signed-off-by: Danial Eskandari <doneskandari@gmail.com> --------- Signed-off-by: Danial Eskandari <doneskandari@gmail.com> Signed-off-by: machine424 <ayoubmrini424@gmail.com>
…16052) * fix: set gogc default value when config body is empty Signed-off-by: Danial Eskandari <doneskandari@gmail.com> * refactor: explicitly check value 75 in `TestGoGCDefaultValueOnEmptyConfigBody` add GoGC assertion in `TestEmptyConfig`, also removed the no longer needed runtime config assignment in `TestEmptyGlobalBlock` Signed-off-by: Danial Eskandari <doneskandari@gmail.com> * refactor: remove `TestGoGCDefaultValueOnEmptyConfigBody` to reduce duplicate assertions Signed-off-by: Danial Eskandari <doneskandari@gmail.com> --------- Signed-off-by: Danial Eskandari <doneskandari@gmail.com> Signed-off-by: machine424 <ayoubmrini424@gmail.com>
…16052) * fix: set gogc default value when config body is empty Signed-off-by: Danial Eskandari <doneskandari@gmail.com> * refactor: explicitly check value 75 in `TestGoGCDefaultValueOnEmptyConfigBody` add GoGC assertion in `TestEmptyConfig`, also removed the no longer needed runtime config assignment in `TestEmptyGlobalBlock` Signed-off-by: Danial Eskandari <doneskandari@gmail.com> * refactor: remove `TestGoGCDefaultValueOnEmptyConfigBody` to reduce duplicate assertions Signed-off-by: Danial Eskandari <doneskandari@gmail.com> --------- Signed-off-by: Danial Eskandari <doneskandari@gmail.com> Signed-off-by: machine424 <ayoubmrini424@gmail.com>
backport[2.53]: config: set gogc default value when config body is empty (#16052)
…16052) Signed-off-by: Nontawat Numor <nontawat39@gmail.com>
…16052) Signed-off-by: Nontawat Numor <nontawat39@gmail.com>
…exists Fixes: prometheus#16334 Related to: - prometheus#15238 - prometheus#16052 Currently, when the GOGC environment variable is set -- and no `runtime` block is set in the Prometheus config file -- it is ignored and the default value of 75% is always used. However, if there is an empty runtime block (e.g. `runtime: {}`), _then_ the GOGC environment variable is checked. This PR changes this behavior to consistently check and use the GOGC environment variable when it is set (unless the `gogc` field is set in the `runtime` block of the loaded config file, in which case it still gives that precedence). Co-authored-by: Adam Rambo <arambo@protonmail.com> Signed-off-by: Will Hegedus <whegedus@akamai.com>
…exists Fixes: prometheus#16334 Related to: - prometheus#15238 - prometheus#16052 Currently, when the GOGC environment variable is set -- and no `runtime` block is set in the Prometheus config file -- it is ignored and the default value of 75% is always used. However, if there is an empty runtime block (e.g. `runtime: {}`), _then_ the GOGC environment variable is checked. This PR changes this behavior to consistently check and use the GOGC environment variable when it is set (unless the `gogc` field is set in the `runtime` block of the loaded config file, in which case it still gives that precedence). Co-authored-by: Adam Rambo <arambo@protonmail.com> Signed-off-by: Will Hegedus <whegedus@akamai.com>
This PR resolves the issue where running Prometheus with an empty config body results in
GoGC
being set to0
. The fix ensures that the default value ofGoGC
is properly set inDefaultConfig
.Fixes #16029