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

profiler: get the correct profile for goroutine wait profile #1262

Merged
merged 2 commits into from
Apr 28, 2022

Conversation

nsrip-dd
Copy link
Contributor

PR #842 refactored the profiling code and in the proccess changed the
pprof lookup for the goroutine wait profile from

pprof.Lookup("goroutine")

to

pprof.Lookup("goroutinewait")

(by looking up using the profileType.Name field as the key). That
profile type doesn't exist, so the lookup always fails.

The existing TestRunProfile didn't catch this because the test replaces
the real profile lookup with a function that provides a fixed profile.
Add an additional test that runs the real profiles and checks that they
all at least show up in the uploaded batch of profiles.

PR #842 refactored the profiling code and in the proccess changed the
pprof lookup for the goroutine wait profile from

	pprof.Lookup("goroutine")

to

	pprof.Lookup("goroutinewait")

(by looking up using the profileType.Name field as the key). That
profile type doesn't exist, so the lookup always fails.

The existing TestRunProfile didn't catch this because the test replaces
the real profile lookup with a function that provides a fixed profile.
Add an additional test that runs the real profiles and checks that they
all at least show up in the uploaded batch of profiles.
@nsrip-dd nsrip-dd requested a review from a team as a code owner April 27, 2022 13:36
@nsrip-dd nsrip-dd added this to the 1.39.0 milestone Apr 27, 2022
Copy link
Member

@felixge felixge left a comment

Choose a reason for hiding this comment

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

LGTM 🙏. Please go ahead and merge!

@@ -334,3 +339,72 @@ func unstartedProfiler(opts ...Option) (*profiler, error) {
p.uploadFunc = func(_ batch) error { return nil }
return p, nil
}

func TestAllUploaded(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

I like smoke tests like this 👍. Much nicer than the other tests that rely on hacking up internals to intercept calls and stuff.

@nsrip-dd nsrip-dd merged commit 4edd4a8 into v1 Apr 28, 2022
@nsrip-dd nsrip-dd deleted the nick.ripley/fix-goroutine-wait-profile branch April 28, 2022 11:58
Hellzy pushed a commit that referenced this pull request Apr 28, 2022
PR #842 refactored the profiling code and in the proccess changed the
pprof lookup for the goroutine wait profile from

	pprof.Lookup("goroutine")

to

	pprof.Lookup("goroutinewait")

(by looking up using the profileType.Name field as the key). That
profile type doesn't exist, so the lookup always fails.

The existing TestRunProfile didn't catch this because the test replaces
the real profile lookup with a function that provides a fixed profile.
Add an additional test that runs the real profiles and checks that they
all at least show up in the uploaded batch of profiles.
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.

None yet

2 participants