Skip to content

Conversation

wbh1
Copy link
Contributor

@wbh1 wbh1 commented May 5, 2025

Fixes: #16334

Related to:

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).

@wbh1
Copy link
Contributor Author

wbh1 commented May 6, 2025

cc: @machine424 since you've been working in this area recently 🙂

Copy link
Member

@bboreham bboreham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@machine424
Copy link
Member

thanks, let's merge #15238 first and you can uncomment the two cases.

@machine424
Copy link
Member

the PR was merged by the way

…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>
@wbh1 wbh1 force-pushed the fix/GOGC-ENV-VAR branch from cc12b9e to c5e3d51 Compare May 12, 2025 11:47
Signed-off-by: Will Hegedus <whegedus@akamai.com>
@wbh1 wbh1 force-pushed the fix/GOGC-ENV-VAR branch from c5e3d51 to 5d94ad9 Compare May 12, 2025 11:49
@wbh1
Copy link
Contributor Author

wbh1 commented May 12, 2025

@machine424 I've rebased and enabled those new tests from your PR. Let me know if there's anything else that's needed!

Copy link
Member

@machine424 machine424 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks again

@machine424 machine424 merged commit 2690761 into prometheus:main May 13, 2025
27 checks passed
@wbh1 wbh1 deleted the fix/GOGC-ENV-VAR branch May 14, 2025 16:07
@Rohlik
Copy link

Rohlik commented Jun 26, 2025

Looking for release 🙏🏼.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GOGC is ignored when config file is empty or when only unrelated config is set
4 participants