Cgroupv2: Added CPU, Memory metrics #1376
Conversation
|
Hi @Zyqsempai. Thanks for your PR. I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
| cs.Memory = &runtime.MemoryUsage{ | ||
| Timestamp: stats.Timestamp.UnixNano(), | ||
| WorkingSetBytes: &runtime.UInt64Value{ | ||
| Value: metrics.Memory.Usage, |
There was a problem hiding this comment.
needs consideration for inactive_file as in v1 implementation? (I haven't looked into whether v2 inactive_file really corresponds to v1 total_inactive_file)
cc @Random-Liu
There was a problem hiding this comment.
It's a good question actually, but it seems like they just removed prefix total from all the metrics in v2.
|
/ok-to-test |
| cs.Cpu = &runtime.CpuUsage{ | ||
| Timestamp: stats.Timestamp.UnixNano(), | ||
| UsageCoreNanoSeconds: &runtime.UInt64Value{Value: metrics.CPU.Usage.Total}, | ||
| switch s.(type) { |
There was a problem hiding this comment.
You can use switch metric := s.(type) { and then you dont need the type assertion below.
| if err != nil { | ||
| return nil, errors.Wrap(err, "failed to extract container metrics") | ||
| } | ||
| metrics := s.(*v1.Metrics) |
There was a problem hiding this comment.
@Random-Liu - This would have previously panic'd if this wasnt the return type. Should we have a default case where we return error or maintain this?
There was a problem hiding this comment.
The CRI expects failure on conversion errors. We should not panic... we should return the error.
jterry75
left a comment
There was a problem hiding this comment.
I like it! Minor questions
AkihiroSuda
left a comment
There was a problem hiding this comment.
LGTM, but please consider squashing commits
292737b to
e67cc43
Compare
e67cc43 to
b515c20
Compare
|
/test pull-cri-containerd-verify |
1 similar comment
|
/test pull-cri-containerd-verify |
|
/test pull-cri-containerd-verify |
|
vendor failing |
Signed-off-by: Boris Popovschi <zyqsempai@mail.ru>
b515c20 to
6b8846c
Compare
|
/test pull-cri-containerd-node-e2e |
|
Green! |
| } | ||
| } | ||
| default: | ||
| return &cs, errors.New(fmt.Sprintf("unxpected metrics type: %v", metrics)) |
There was a problem hiding this comment.
typo: "unxpected"
Also, you can use errors.Errorf here.
|
merging, typo is negligible |
Related to containerd/containerd#3726
Vendor updated to the last and stble versions of contqinerd and cgroups
Added cgroupv2 metrics.
Signed-off-by: Boris Popovschi zyqsempai@mail.ru