-
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
add support for cgroup CPUQuota and CPUPeriod prometheus limit #969
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -207,6 +207,16 @@ func (self *rawContainerHandler) GetSpec() (info.ContainerSpec, error) { | |
if utils.FileExists(cpuRoot) { | ||
spec.HasCpu = true | ||
spec.Cpu.Limit = readUInt64(cpuRoot, "cpu.shares") | ||
spec.Cpu.Period = readUInt64(cpuRoot, "cpu.cfs_period_us") | ||
quota := readString(cpuRoot, "cpu.cfs_quota_us") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because if the quota is not set, -1 is returned and internally readInt64 uses an uint and this breaks with -1 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't check that - so really There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes this would be much cleaner |
||
|
||
if quota != "-1" { | ||
val, err := strconv.ParseUint(quota, 10, 64) | ||
if err != nil { | ||
glog.Errorf("raw driver: Failed to parse CPUQuota from %q: %s", path.Join(cpuRoot, "cpu.cfs_quota_us"), err) | ||
} | ||
spec.Cpu.Quota = val | ||
} | ||
} | ||
} | ||
|
||
|
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.
Why add this metric only to the raw driver?
Is it possible to extract this metrics even for docker containers?
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.
@f0 Any thoughts on this?
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.
@jimmidyson hm not really , why not but i think this should be done in a different PR