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

Introduce ability to get profile data #1215

Merged
merged 1 commit into from
Jan 31, 2025

Conversation

bcrochet
Copy link
Contributor

This exposes two environment variables, PFLT_MEMPROFILE and PFLT_CPUPROFILE, that should be set to the path and name of a file to write the profile data to. These can then be processed with go tool pprof for further analysis.

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 20, 2024
@coveralls
Copy link

coveralls commented Nov 20, 2024

Coverage Status

coverage: 84.119% (-0.3%) from 84.446%
when pulling aa27bd4 on bcrochet:profile
into 0184783 on redhat-openshift-ecosystem:main.

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 20, 2024
@dcibot
Copy link

dcibot commented Nov 20, 2024

defer f.Close()

if err := pprof.StartCPUProfile(f); err != nil {
logger.Error(err, "could not start CPU profile")
Copy link
Contributor

Choose a reason for hiding this comment

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

should this error be returned?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. I'll add that.

if viper.Instance().IsSet("memprofile") {
f, err := os.Create(viper.Instance().GetString("memprofile"))
if err != nil {
logger.Error(err, "could not create memory profile")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this error be returned?


rt.GC() // get up-to-date statistics
if err := pprof.Lookup("allocs").WriteTo(f, 0); err != nil {
logger.Error(err, "could not start memory profile")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this error be returned?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ditto.

Copy link
Contributor

@komish komish left a comment

Choose a reason for hiding this comment

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

Any particular reason why this is only being added to CheckContainer?

@bcrochet
Copy link
Contributor Author

Any particular reason why this is only being added to CheckContainer?

It was where I knew we were looking for a data from. If we decide we need it elsewhere in the future, we can cross that bridge then.

This exposes two environment variables, PFLT_MEMPROFILE and
PFLT_CPUPROFILE, that should be set to the path and name of a file to
write the profile data to. These can then be processed with `go tool
pprof` for further analysis.

Signed-off-by: Brad P. Crochet <[email protected]>
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Nov 26, 2024
@dcibot
Copy link

dcibot commented Nov 26, 2024

Copy link
Contributor

@komish komish left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 31, 2025
Copy link

openshift-ci bot commented Jan 31, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bcrochet, komish, skattoju

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:
  • OWNERS [bcrochet,komish,skattoju]

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

@acornett21 acornett21 merged commit bb48d9c into redhat-openshift-ecosystem:main Jan 31, 2025
5 of 6 checks passed
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. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants