-
Notifications
You must be signed in to change notification settings - Fork 65
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
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bcrochet, 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:
Approvers can indicate their approval by writing |
from change #1215: |
defer f.Close() | ||
|
||
if err := pprof.StartCPUProfile(f); err != nil { | ||
logger.Error(err, "could not start CPU profile") |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
There was a problem hiding this 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?
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]>
New changes are detected. LGTM label has been removed. |
from change #1215: |
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.