Skip to content

Commit e921636

Browse files
qiutongsbobbypage
authored andcommitted
ignore sandbox container when getting file system metrics
1 parent f38d073 commit e921636

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

container/containerd/handler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func newContainerdContainerHandler(
164164
// Add the name and bare ID as aliases of the container.
165165
handler.image = cntr.Image
166166

167-
if includedMetrics.Has(container.DiskUsageMetrics) {
167+
if includedMetrics.Has(container.DiskUsageMetrics) && cntr.Labels["io.cri-containerd.kind"] != "sandbox" {
168168
handler.fsHandler = common.NewFsHandler(common.DefaultPeriod, &fsUsageProvider{
169169
ctx: ctx,
170170
client: client,
@@ -228,7 +228,7 @@ func (h *containerdContainerHandler) getFsStats(stats *info.ContainerStats) erro
228228
common.AssignDeviceNamesToDiskStats((*common.MachineInfoNamer)(mi), &stats.DiskIo)
229229
}
230230

231-
if !h.includedMetrics.Has(container.DiskUsageMetrics) {
231+
if !h.includedMetrics.Has(container.DiskUsageMetrics) || h.labels["io.cri-containerd.kind"] == "sandbox" {
232232
return nil
233233
}
234234

0 commit comments

Comments
 (0)