-
Notifications
You must be signed in to change notification settings - Fork 8
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
feat: add goroutine watcher #16
base: main
Are you sure you want to change the base?
Conversation
@@ -53,8 +64,9 @@ type autoPprof struct { | |||
reportBoth bool |
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.
This field is an option that is only valid when monitoring only two things, CPU and memory, and as the runtime monitor increases, its meaning becomes less meaningful.
@mingrammer Please give me your opinion on how to remove it in a separate version!
@@ -858,13 +1020,13 @@ func BenchmarkLightJob(b *testing.B) { | |||
|
|||
func BenchmarkLightJobWithWatchCPUUsage(b *testing.B) { |
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.
i think we need to benckmark goroutine watcher too.
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.
I artificially created a lot of goroutines and ran a benchmark test. This is my first time doing a test like this. What should I fix?
BenchmarkLightAsyncJob-5 376760 32056 ns/op 7040 B/op 352 allocs/op
BenchmarkLightAsyncJobWithWatchGoroutineCount-5 350994 33689 ns/op 7040 B/op 351 allocs/op
BenchmarkHeavyAsyncJob-5 414 29095456 ns/op 6001969 B/op 300096 allocs/op
BenchmarkHeavyAsyncJobWithWatchGoroutineCount-5 403 29474789 ns/op 5972177 B/op 298607 allocs/op
return err | ||
} | ||
|
||
runtimeQryer, err := queryer.NewRuntimeQueryer() |
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.
typo?
func (s *SlackReporter) ReportGoroutineProfile( | ||
ctx context.Context, r io.Reader, gi GoroutineInfo, | ||
) error { | ||
hostname, _ := os.Hostname() // Don't care about this 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.
p999; I think this comment is vague, how about just removing it?
} | ||
var ( | ||
sm = stat.Memory | ||
usage = sm.Usage.Usage - sm.InactiveFile |
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.
nice
return 0, nil | ||
} | ||
|
||
s1, s2 := c.q.head(), c.q.tail() |
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.
circular queue ! nice
queryer
was managed as a separate dir and its implementation was divided. (cgroup & runtime)Queryer
interface method to public.queryer
, I also wanted to manageprofiler
in dir, but I did not consider this part.queryer
andprofiler
, but did not do so.ticker
, so pprof lib is used in bothqueryer
andprofiler
.