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

fix: update docker mem usage to match latest docker CLI #10491

Merged
merged 1 commit into from
Jan 28, 2022
Merged

fix: update docker mem usage to match latest docker CLI #10491

merged 1 commit into from
Jan 28, 2022

Conversation

101100
Copy link
Contributor

@101100 101100 commented Jan 22, 2022

Required for all PRs:

resolve: #10518

This updates the Docker input plugin memory statistics. Specifically, the usage measurement in docker_container_mem is updated so that it will match the value given by the Docker CLI tool version 20.10+. The calculation used in the CLI tool can be seen here. In Docker 20.10, the memory stats available changed and the cache field is no longer present. Instead, depending on the version of cgroups used, either total_inactive_file or inactive_file will be present.

I've added a test of this functionality. The values chosen are odd because in order for the test to pass, the percentage calculation had to match exactly despite floating-point inaccuracies.

The calculation is now able to work with the new cgroup data given by
the docker API and matches the computation done in the CLI.
@telegraf-tiger
Copy link
Contributor

Thanks so much for the pull request!
🤝 ✒️ Just a reminder that the CLA has not yet been signed, and we'll need it before merging. Please sign the CLA when you get a chance, then post a comment here saying !signed-cla

@telegraf-tiger telegraf-tiger bot added the fix pr to fix corresponding bug label Jan 22, 2022
@101100
Copy link
Contributor Author

101100 commented Jan 22, 2022

!signed-cla

@sspaink sspaink added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Jan 27, 2022
Copy link
Contributor

@powersj powersj left a comment

Choose a reason for hiding this comment

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

Thank you very much for this fix!

@powersj powersj merged commit ac65eb6 into influxdata:master Jan 28, 2022
@101100 101100 deleted the update-docker-mem-usage branch January 28, 2022 21:29
powersj pushed a commit that referenced this pull request Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix pr to fix corresponding bug ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docker container stats incorrectly include cache usage in memory usage
3 participants