Add pprof endpoint, disabled by default
This commit is contained in:
parent
cad8156353
commit
1f6ec1d9f5
|
@ -8,6 +8,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-chi/chi/v5/middleware"
|
||||||
"github.com/navidrome/navidrome/conf"
|
"github.com/navidrome/navidrome/conf"
|
||||||
"github.com/navidrome/navidrome/consts"
|
"github.com/navidrome/navidrome/consts"
|
||||||
"github.com/navidrome/navidrome/core"
|
"github.com/navidrome/navidrome/core"
|
||||||
|
@ -96,6 +97,9 @@ func startServer(ctx context.Context) func() error {
|
||||||
core.WriteInitialMetrics()
|
core.WriteInitialMetrics()
|
||||||
a.MountRouter("Prometheus metrics", conf.Server.Prometheus.MetricsPath, promhttp.Handler())
|
a.MountRouter("Prometheus metrics", conf.Server.Prometheus.MetricsPath, promhttp.Handler())
|
||||||
}
|
}
|
||||||
|
if conf.Server.DevEnableProfiler {
|
||||||
|
a.MountRouter("Profiling", "/debug", middleware.Profiler())
|
||||||
|
}
|
||||||
if strings.HasPrefix(conf.Server.UILoginBackgroundURL, "/") {
|
if strings.HasPrefix(conf.Server.UILoginBackgroundURL, "/") {
|
||||||
a.MountRouter("Background images", consts.DefaultUILoginBackgroundURL, backgrounds.NewHandler())
|
a.MountRouter("Background images", consts.DefaultUILoginBackgroundURL, backgrounds.NewHandler())
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,7 @@ type configOptions struct {
|
||||||
// DevFlags. These are used to enable/disable debugging and incomplete features
|
// DevFlags. These are used to enable/disable debugging and incomplete features
|
||||||
DevLogSourceLine bool
|
DevLogSourceLine bool
|
||||||
DevLogLevels map[string]string
|
DevLogLevels map[string]string
|
||||||
|
DevEnableProfiler bool
|
||||||
DevAutoCreateAdminPassword string
|
DevAutoCreateAdminPassword string
|
||||||
DevAutoLoginUsername string
|
DevAutoLoginUsername string
|
||||||
DevActivityPanel bool
|
DevActivityPanel bool
|
||||||
|
@ -303,6 +304,7 @@ func init() {
|
||||||
|
|
||||||
// DevFlags. These are used to enable/disable debugging and incomplete features
|
// DevFlags. These are used to enable/disable debugging and incomplete features
|
||||||
viper.SetDefault("devlogsourceline", false)
|
viper.SetDefault("devlogsourceline", false)
|
||||||
|
viper.SetDefault("devenableprofiler", false)
|
||||||
viper.SetDefault("devautocreateadminpassword", "")
|
viper.SetDefault("devautocreateadminpassword", "")
|
||||||
viper.SetDefault("devautologinusername", "")
|
viper.SetDefault("devautologinusername", "")
|
||||||
viper.SetDefault("devactivitypanel", true)
|
viper.SetDefault("devactivitypanel", true)
|
||||||
|
|
Loading…
Reference in New Issue