this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

hepa: add pprof endpoint, and enable block profiling. (#563)

Hepa already has an http service for prometh metrics, and it's the http
package's default one, so this continues to just dogpile on that.

With the defaults, http://localhost:3989/debug/pprof/ is now
informative.

Also added nudges to the runtime to enable block profiling and mutex
profiling. Without these nudges, those reports are empty.

I picked the rate numbers here somewhat capriciously; they may need
tuning to keep impact down in prod, or we may end up needing knobs for
toggling this at runtime. We'll see.

(The goroutine profiles alone, requested periodically, provide a decent
sampling of data that can be used to infer some things about blocking
anyway, even if that pprof feature isn't enabled explicitly! But more
data is almost always better, so I propose turning it on for now.)

authored by

bnewbold and committed by
GitHub
46cba8dc 3154037c

+4
+4
cmd/hepa/main.go
··· 7 7 "io" 8 8 "log/slog" 9 9 "net/http" 10 + _ "net/http/pprof" 10 11 "os" 12 + "runtime" 11 13 "strings" 12 14 "time" 13 15 ··· 235 237 236 238 // prometheus HTTP endpoint: /metrics 237 239 go func() { 240 + runtime.SetBlockProfileRate(10) 241 + runtime.SetMutexProfileFraction(10) 238 242 if err := srv.RunMetrics(cctx.String("metrics-listen")); err != nil { 239 243 slog.Error("failed to start metrics endpoint", "error", err) 240 244 panic(fmt.Errorf("failed to start metrics endpoint: %w", err))