fix(pprof): settings rates can be nil

This commit is contained in:
Quentin McGaw
2023-04-12 10:14:05 +00:00
parent d4f8eea7bf
commit fa7fd5f076
6 changed files with 63 additions and 52 deletions

View File

@@ -13,8 +13,8 @@ import (
// with the settings given. It returns an error
// if one of the settings is not valid.
func New(settings Settings) (server *httpserver.Server, err error) {
runtime.SetBlockProfileRate(settings.BlockProfileRate)
runtime.SetMutexProfileFraction(settings.MutexProfileRate)
runtime.SetBlockProfileRate(*settings.BlockProfileRate)
runtime.SetMutexProfileFraction(*settings.MutexProfileRate)
handler := http.NewServeMux()
handler.HandleFunc("/debug/pprof/", pprof.Index)