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

profiling: remove some dependencies #328

Merged
merged 7 commits into from
Apr 20, 2020
Merged

Conversation

rleungx
Copy link
Member

@rleungx rleungx commented Apr 7, 2020

No description provided.

Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
@rleungx rleungx changed the title profiling: remove go dependency profiling: remove some dependencies Apr 8, 2020
Copy link
Member

@breezewish breezewish left a 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) {
Copy link
Member

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?

Copy link
Member Author

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

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) {
Copy link
Member

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

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
Copy link
Member

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

case utils.NodeKindTiKV, utils.NodeKindTiDB:
url = "/debug/pprof/profile?seconds=" + secs
case utils.NodeKindTiKV:
return fetchFlameGraphSVG(ctx, httpClient, target, fileNameWithoutExt, profileDurationSecs, tls)
Copy link
Member

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?

Copy link
Member Author

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

@breezewish breezewish linked an issue Apr 8, 2020 that may be closed by this pull request
Signed-off-by: Ryan Leung <rleungx@gmail.com>
rleungx and others added 4 commits April 9, 2020 12:20
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
@breezewish
Copy link
Member

Manually confirmed that it works 👏

@breezewish breezewish merged commit 5f9eaa4 into pingcap:master Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UCP: Support generating profiling graph without go and pprof
2 participants