Skip to content
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 --profile-{cpu,mem} flags #1683

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

saschagrunert
Copy link
Member

What type of PR is this?

/kind feature

What this PR does / why we need it:

The flags allow debugging crictl with respect to CPU and memory consumption.

Which issue(s) this PR fixes:

None

Special notes for your reviewer:

Users reported strange memory behavior when running crictl ps which is not reproducible for me. Adding the flags will give us more insights and could be beneficial to others.

Does this PR introduce a user-facing change?

Added crictl `--profile-{cpu,mem}` flags for debugging the application.

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 14, 2024
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 14, 2024
@saschagrunert saschagrunert force-pushed the cpu-mem-profile branch 4 times, most recently from 6e76f2f to 4e541d9 Compare November 14, 2024 10:51
cmd/crictl/main.go Outdated Show resolved Hide resolved
if cpuProfilePath != "" {
logrus.Infof("Creating CPU profile in: %s", cpuProfilePath)

file, err := os.Create(cpuProfilePath)
Copy link
Member

Choose a reason for hiding this comment

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

so it will fail if file already exists? Should we simply override it instead of failing? It is kind of unusual for a command to fail if retried.

Copy link
Member Author

Choose a reason for hiding this comment

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

No, it will re-use the file:

func Create(name string) (*File, error) {
	return OpenFile(name, O_RDWR|O_CREATE|O_TRUNC, 0666)
}

cmd/crictl/main.go Outdated Show resolved Hide resolved
@saschagrunert saschagrunert force-pushed the cpu-mem-profile branch 2 times, most recently from 653a1da to a4925a3 Compare November 15, 2024 07:40
The flags allow debugging `crictl` with respect to CPU and memory
consumption.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
Copy link
Member

@SergeyKanzhelev SergeyKanzhelev left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 15, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: saschagrunert, SergeyKanzhelev

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit a235aff into kubernetes-sigs:master Nov 15, 2024
35 checks passed
@saschagrunert saschagrunert deleted the cpu-mem-profile branch November 18, 2024 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants