-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[extension/cgroupruntime] Be aware of ECS task and CPU limits #36814
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Thanks for submitting this feature request @r0mdau, I support on adding this feature as well. Do you know if there is a reliable way to know if the binary is running within ECS? If ECS_CONTAINER_METADATA_URI_V4 environment variable is always available within an ECS container, we could check its existence to use the https://github.com/rdforte/gomaxecs/ instead. |
I checked on multiple ECS clusters we manage and I confirm this environment variable is pushed and available in the container (ECS Task). For reference, you need a certain version
v1.39.0 is April 2020 old : https://github.com/aws/amazon-ecs-agent/tree/v1.39.0 All the releases: https://github.com/aws/amazon-ecs-agent/releases |
Implementation proposition 1, add the logic in the import maxprocsecs "github.com/rdforte/gomaxecs/maxprocs"
...
const awsEcsContainerMetadataUri = "ECS_CONTAINER_METADATA_URI_V4"
...
func() (undoFunc, error) {
var err error
var undo func()
if os.Getenv(awsEcsContainerMetadataUri) != "" {
prev := runtime.GOMAXPROCS(0)
undo = func() {
set.Logger.Debug(fmt.Sprintf("maxprocs: Resetting GOMAXPROCS to %v", prev))
runtime.GOMAXPROCS(prev)
}
maxprocsecs.Set(log.Default())
} else {
undo, err = maxprocs.Set(maxprocs.Logger(func(str string, params ...any) {
set.Logger.Debug(fmt.Sprintf(str, params))
}))
}
return undoFunc(undo), err
}, Proposition 2 is to submit a PR to the rdforte/gomaxecs repo to include the same |
@r0mdau If you were leaning towards Proposition 2 I would be onboard to make the change to rdforte/gomaxecs. |
@rdforte To me, the uber-go/automaxprocs implementation for the |
@r0mdau I have added a draft PR which implements the changes as mentioned for Proposition 2. I also added a new method |
That would be awesome, thanks! Having similar APIs for the packages we use will facilitate the integration and maintainability of the extension. |
@mx-psi Do you support adding this feature as well? Using https://github.com/rdforte/gomaxecs/ looks like a good fit for this use case. Shall we wait for the integrations tests before implementing this? |
I think we should wait but I support adding the feature after this |
Component(s)
extension/cgroupruntime
Is your feature request related to a problem? Please describe.
The automaxprocs library from Uber is not setting GOMAXPROCS in a ECS task environment.
See this issue: uber-go/automaxprocs#66
Describe the solution you'd like
Try to integrate the rdforte/gomaxecs library that solves the issue.
Describe alternatives you've considered
Creating a custom collector, disabling gomaxprocs and only using auto memory limit for this extension + adding rdforte/gomaxecs library
Additional context
No response
The text was updated successfully, but these errors were encountered: