mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
fix(diagnostics): profiling config flags (#1637)
This commit is contained in:
parent
b681846b51
commit
34d6e0cf60
3 changed files with 8 additions and 8 deletions
|
@ -88,7 +88,7 @@ sessionSecret = "{{ .sessionSecret }}"
|
||||||
|
|
||||||
# Golang pprof profiling and tracing
|
# Golang pprof profiling and tracing
|
||||||
#
|
#
|
||||||
#profiling = false
|
#profilingEnabled = false
|
||||||
#
|
#
|
||||||
#profilingHost = "127.0.0.1"
|
#profilingHost = "127.0.0.1"
|
||||||
#
|
#
|
||||||
|
@ -315,7 +315,7 @@ func (c *AppConfig) loadFromEnv() {
|
||||||
c.Config.PostgresExtraParams = v
|
c.Config.PostgresExtraParams = v
|
||||||
}
|
}
|
||||||
|
|
||||||
if v := os.Getenv(prefix + "PROFILING"); v != "" {
|
if v := os.Getenv(prefix + "PROFILING_ENABLED"); v != "" {
|
||||||
c.Config.ProfilingEnabled = strings.EqualFold(strings.ToLower(v), "true")
|
c.Config.ProfilingEnabled = strings.EqualFold(strings.ToLower(v), "true")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,11 +16,11 @@ func SetupProfiling(enabled bool, host string, port int) {
|
||||||
if enabled {
|
if enabled {
|
||||||
go func() {
|
go func() {
|
||||||
// pprof has an init method which adds the following endpoints
|
// pprof has an init method which adds the following endpoints
|
||||||
// http.HandleFunc(prefix+"/debug/pprof/", Index)
|
// GET /debug/pprof/
|
||||||
// http.HandleFunc(prefix+"/debug/pprof/cmdline", Cmdline)
|
// GET /debug/pprof/cmdline
|
||||||
// http.HandleFunc(prefix+"/debug/pprof/profile", Profile)
|
// GET /debug/pprof/profile
|
||||||
// http.HandleFunc(prefix+"/debug/pprof/symbol", Symbol)
|
// GET /debug/pprof/symbol
|
||||||
// http.HandleFunc(prefix+"/debug/pprof/trace", Trace)
|
// GET /debug/pprof/trace
|
||||||
err := http.ListenAndServe(fmt.Sprintf("%s:%d", host, port), nil)
|
err := http.ListenAndServe(fmt.Sprintf("%s:%d", host, port), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Error starting profiling server: %v", err)
|
log.Printf("Error starting profiling server: %v", err)
|
||||||
|
|
|
@ -24,7 +24,7 @@ type Config struct {
|
||||||
PostgresPass string `toml:"postgresPass"`
|
PostgresPass string `toml:"postgresPass"`
|
||||||
PostgresSSLMode string `toml:"postgresSSLMode"`
|
PostgresSSLMode string `toml:"postgresSSLMode"`
|
||||||
PostgresExtraParams string `toml:"postgresExtraParams"`
|
PostgresExtraParams string `toml:"postgresExtraParams"`
|
||||||
ProfilingEnabled bool `toml:"profiling"`
|
ProfilingEnabled bool `toml:"profilingEnabled"`
|
||||||
ProfilingHost string `toml:"profilingHost"`
|
ProfilingHost string `toml:"profilingHost"`
|
||||||
ProfilingPort int `toml:"profilingPort"`
|
ProfilingPort int `toml:"profilingPort"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue