Skip to content

Use new filtered cgroups stats API#12901

Merged
fuweid merged 1 commit into
containerd:mainfrom
dcantah:bump-cg-filterstats
Feb 25, 2026
Merged

Use new filtered cgroups stats API#12901
fuweid merged 1 commit into
containerd:mainfrom
dcantah:bump-cg-filterstats

Conversation

@dcantah

@dcantah dcantah commented Feb 15, 2026

Copy link
Copy Markdown
Member

In some spots we can get away with only reading a subset of the cgroup stats we are today. It would be reaaally nice for container stats in the cri plugin, but they're requested via the task API and we have no way to signify we only want a subset through this surface yet. We can still get some benefit in the stats collector and the existing sandbox stats where we only need mem and cpu.

@github-project-automation github-project-automation Bot moved this to Needs Triage in Pull Request Review Feb 15, 2026
@dcantah dcantah force-pushed the bump-cg-filterstats branch from 3a61f3d to 31c80bb Compare February 17, 2026 00:03
@dcantah dcantah marked this pull request as ready for review February 17, 2026 22:19
@dosubot dosubot Bot added the dependencies Pull requests that update a dependency file label Feb 17, 2026
@estesp

estesp commented Feb 18, 2026

Copy link
Copy Markdown
Member

The cgroups update was handled by dependabot and merged; seems like you can drop that commit and rebase?

@dmcgowan dmcgowan added this to the 2.3 milestone Feb 19, 2026
In some spots we can get away with only reading a subset of the cgroup
stats we are today. It would be reaaally nice for container stats in
the cri plugin, but they're requested via the task API and we have no
way to signify we only want a subset through this surface yet. We can
still get some benefit in the stats collector and the existing sandbox
stats where we only need mem and cpu.

Signed-off-by: Danny Canter <danny@dcantah.dev>
@dcantah dcantah force-pushed the bump-cg-filterstats branch from 31c80bb to d7d7b10 Compare February 20, 2026 12:16
@dcantah dcantah changed the title deps: Bump cgroups and use new filtered stats API Use new filtered cgroups stats API Feb 20, 2026
@dcantah

dcantah commented Feb 20, 2026

Copy link
Copy Markdown
Member Author

@estesp done!

@fuweid fuweid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

Just have one small suggestion

if err != nil {
return nil, fmt.Errorf("failed to load sandbox cgroup: %v: %w", cgroupPath, err)
}
stats, err := cg.Stat()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we limit it to CPU and memory, we should rename the function as well—just in case other callers use it and assume it returns all information.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fair. Technically on cg1 systems we'd still be getting all of the stats, and we still return this local struct today:

type cgroupMetrics struct {
	v1 *cg1.Metrics
	v2 *cg2.Metrics
}

Would you want to change this to also just return mem and cpu values for both to be more clear?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can handle that in a follow-up. For now, this function is only called in one place.

@github-project-automation github-project-automation Bot moved this from Needs Triage to Review In Progress in Pull Request Review Feb 21, 2026
@fuweid fuweid added this pull request to the merge queue Feb 25, 2026
Merged via the queue into containerd:main with commit 589bf74 Feb 25, 2026
53 checks passed
@github-project-automation github-project-automation Bot moved this from Review In Progress to Done in Pull Request Review Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/runtime Runtime dependencies Pull requests that update a dependency file impact/changelog size/S

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants