diff --git a/cri/v1alpha1/cri.go b/cri/v1alpha1/cri.go index 5dda38b2b6..700b5d56bc 100644 --- a/cri/v1alpha1/cri.go +++ b/cri/v1alpha1/cri.go @@ -822,7 +822,7 @@ func (c *CriManager) ContainerStats(ctx context.Context, r *runtime.ContainerSta func (c *CriManager) ListContainerStats(ctx context.Context, r *runtime.ListContainerStatsRequest) (*runtime.ListContainerStatsResponse, error) { opts := &mgr.ContainerListOption{All: true} filter := func(c *mgr.Container) bool { - return true + return c.Config.Labels[containerTypeLabelKey] == containerTypeLabelContainer } opts.FilterFunc = filter diff --git a/cri/v1alpha2/cri.go b/cri/v1alpha2/cri.go index 9d67f3ce3e..7597eb99aa 100644 --- a/cri/v1alpha2/cri.go +++ b/cri/v1alpha2/cri.go @@ -918,7 +918,7 @@ func (c *CriManager) ContainerStats(ctx context.Context, r *runtime.ContainerSta func (c *CriManager) ListContainerStats(ctx context.Context, r *runtime.ListContainerStatsRequest) (*runtime.ListContainerStatsResponse, error) { opts := &mgr.ContainerListOption{All: true} filter := func(c *mgr.Container) bool { - return true + return c.Config.Labels[containerTypeLabelKey] == containerTypeLabelContainer } opts.FilterFunc = filter