-
Notifications
You must be signed in to change notification settings - Fork 814
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
[docker_daemon] Add metadata, tests and fix missing yaml option #2453
Conversation
a0f2991
to
798c86f
Compare
return {} | ||
if used > 0.0 and total > 0.0: | ||
percs['docker.{0}.percent'.format(mtype)] = round(100 * float(used) / float(total), 2) | ||
elif free > 0.0 and total > 0.0: |
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.
I think free
could legitly be 0.0.
798c86f
to
3104b2d
Compare
Thanks for the feedback @truthbk, updated some things and added some testing. |
used = stats.get('docker.{0}.used'.format(mtype)) | ||
total = stats.get('docker.{0}.total'.format(mtype)) | ||
free = stats.get('docker.{0}.free'.format(mtype)) | ||
if used and total and free and total < free + used: |
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.
Should we add a small rounding tolerance factor here ?
I'd say that other than @remh consideration, it's looking good. With regards to his point, maybe it makes sense to use the ceiling of "total"? I'll let you decide on that one :) |
3104b2d
to
fd73dfd
Compare
@truthbk added a ceiling of total as a rounding margin. |
👍 looks good... I was unable to run the tests locally. But I trust they're fine after the revamp. Feel free to squash and merge. |
Why this PR
This PR is a fix/improvement for #2405
It adds the same metrics for metadata and modify the existing name for consistency (this has not been released so no user will be impacted), setup testing and fix a missing option in
docker_daemon.yaml
.