Skip to content
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 #36920

Merged
merged 13 commits into from
Jan 8, 2025

Conversation

r0mdau
Copy link
Contributor

@r0mdau r0mdau commented Dec 21, 2024

Description

Allow the cgroupruntime extension to set GOMAXPROCS based on AWS ECS metadata. See related issue for detailed informations.

Link to tracking issue

Fixes #36814

Testing

Added integration test with httptest for the ECS metadata endpoint.

Something to clarify: #36617 (comment)

Documentation

Added extension name and link in the README.

Copy link
Contributor

@rogercoll rogercoll left a comment

Choose a reason for hiding this comment

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

Thanks for adding this, the code lgtm, just left a couple of nits/question.

extension/cgroupruntimeextension/factory.go Outdated Show resolved Hide resolved
extension/cgroupruntimeextension/go.mod Show resolved Hide resolved
extension/cgroupruntimeextension/integration_test.go Outdated Show resolved Hide resolved
extension/cgroupruntimeextension/integration_test.go Outdated Show resolved Hide resolved
@r0mdau
Copy link
Contributor Author

r0mdau commented Dec 27, 2024

@rogercoll writing my local setup for executing the integration test, let me know if I write it in the README or somewhere else.

Inside the extension folder, start a privileged docker container and share the code

cd extension/cgroupruntimeextension
docker run -ti --privileged --cgroupns=host -v $(pwd):/workspace -w /workspace debian:bookworm-slim

Install Go and gcc to run the integration test

apt update && apt install -y wget sudo gcc && wget https://go.dev/dl/go1.23.4.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.23.4.linux-amd64.tar.gz && export PATH=$PATH:/usr/local/go/bin && go version && rm go1.23.4.linux-amd64.tar.gz

Run the integration test

CGO_ENABLED=1 go test -v -exec sudo -race -timeout 360s -parallel 4 -tags=integration,""

@rogercoll
Copy link
Contributor

@rogercoll writing my local setup for executing the integration test, let me know if I write it in the README or somewhere else.

That would be more than welcomed, feel free to update the README (in this or a follow-up PR). Thanks!

@r0mdau
Copy link
Contributor Author

r0mdau commented Dec 30, 2024

@rogercoll writing my local setup for executing the integration test, let me know if I write it in the README or somewhere else.

That would be more than welcomed, feel free to update the README (in this or a follow-up PR). Thanks!

Proposition to start a CONTRIBUTING page: a510187

Copy link
Contributor

@rogercoll rogercoll 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 for adding this feature

@mx-psi
Copy link
Member

mx-psi commented Jan 7, 2025

@r0mdau can you fix the merge conflict?

@r0mdau
Copy link
Contributor Author

r0mdau commented Jan 7, 2025

@r0mdau can you fix the merge conflict?

@mx-psi rebase done

@mx-psi
Copy link
Member

mx-psi commented Jan 7, 2025

Error: cgroupruntimeextension/integration_test.go:35:2: var-naming: const ecsMetadataUri should be ecsMetadataURI (revive)
	ecsMetadataUri     = "ECS_CONTAINER_METADATA_URI_V4"
	^
Error: cgroupruntimeextension/integration_test.go:379:4: os.Setenv() can be replaced by `t.Setenv()` in anonymous function (tenv)
			os.Setenv(ecsMetadataUri, server.URL)
			^

@mx-psi mx-psi merged commit cc1232e into open-telemetry:main Jan 8, 2025
161 checks passed
@github-actions github-actions bot added this to the next release milestone Jan 8, 2025
@r0mdau r0mdau deleted the gomaxecs-procs branch January 9, 2025 01:28
MovieStoreGuy added a commit that referenced this pull request Jan 12, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Reusing the `GOTEST_INTEGRATION_OPT` was skipping Sudo tests `-skip
Sudo`

<!-- Issue number (e.g. #1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes
#36920 (comment)

<!--Describe what testing was performed and which tests were added.-->
#### Testing

<!--Describe the documentation added.-->
#### Documentation

<!--Please delete paragraphs that you did not use before submitting.-->

Co-authored-by: Sean Marciniak <[email protected]>
AkhigbeEromo pushed a commit to sematext/opentelemetry-collector-contrib that referenced this pull request Jan 13, 2025
…elemetry#36920)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Allow the cgroupruntime extension to set GOMAXPROCS based on AWS ECS
metadata. See related issue for detailed informations.

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes open-telemetry#36814 

<!--Describe what testing was performed and which tests were added.-->
#### Testing

Added integration test with `httptest` for the ECS metadata endpoint.

Something to clarify:
open-telemetry#36617 (comment)

<!--Describe the documentation added.-->
#### Documentation

Added extension name and link in the README.

<!--Please delete paragraphs that you did not use before submitting.-->

---------

Signed-off-by: Romain Dauby <[email protected]>
Co-authored-by: Roger Coll <[email protected]>
AkhigbeEromo pushed a commit to sematext/opentelemetry-collector-contrib that referenced this pull request Jan 13, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Reusing the `GOTEST_INTEGRATION_OPT` was skipping Sudo tests `-skip
Sudo`

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes
open-telemetry#36920 (comment)

<!--Describe what testing was performed and which tests were added.-->
#### Testing

<!--Describe the documentation added.-->
#### Documentation

<!--Please delete paragraphs that you did not use before submitting.-->

Co-authored-by: Sean Marciniak <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[extension/cgroupruntime] Be aware of ECS task and CPU limits
4 participants