-
Notifications
You must be signed in to change notification settings - Fork 133
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
profiling: remove some dependencies #328
Conversation
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
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.
cool!
tls bool | ||
} | ||
|
||
func (f *fetcher) Fetch(src string, duration, timeout time.Duration) (*profile.Profile, string, error) { |
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.
do we still need this function?
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.
Yes, we need to use it to get DOT output
pkg/apiserver/profiling/profile.go
Outdated
default: | ||
return "", fmt.Errorf("unsupported target %s", target) | ||
} | ||
} | ||
|
||
func fetchFlameGraphSVG(ctx context.Context, httpClient *http.Client, target *utils.RequestTargetNode, fileNameWithoutExt string, profileDurationSecs uint, tls bool) (string, error) { |
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.
maybe we should call it something like fetchTiKVProfiling since this function will not work for all components
pkg/apiserver/profiling/profile.go
Outdated
url := fmt.Sprintf("%s://%s:%d/debug/pprof/profile?seconds=%d", schema, target.IP, target.Port, profileDurationSecs) | ||
req, err := http.NewRequest(http.MethodGet, url, nil) | ||
if err != nil { | ||
return "", err |
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.
please make some more readable errors
pkg/apiserver/profiling/profile.go
Outdated
case utils.NodeKindTiKV, utils.NodeKindTiDB: | ||
url = "/debug/pprof/profile?seconds=" + secs | ||
case utils.NodeKindTiKV: | ||
return fetchFlameGraphSVG(ctx, httpClient, target, fileNameWithoutExt, profileDurationSecs, tls) |
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.
PD-Allow-follower-handle header will not be set for PD, is it ok?
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.
PD-Allow-follower-handle
will be set for PD in getProfile
function
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Manually confirmed that it works 👏 |
No description provided.