Skip to content

Commit

Permalink
move profilers to debug server (#1098)
Browse files Browse the repository at this point in the history
This makes it more plausible for us to run the profilers in a deployment
setting but also puts the debug stuff where the debug stuff goes.
  • Loading branch information
jmhodges authored Jan 16, 2025
1 parent 6682faa commit eb8f7fe
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,6 @@ func run(conf configuration, listen string, debug bool) {
router.HandleFunc("/sign/data", apiStatsMiddleware(ag.handleSignature, "http.api.sign/data", stats)).Methods("POST")
router.HandleFunc("/sign/hash", apiStatsMiddleware(ag.handleSignature, "http.api.sign/hash", stats)).Methods("POST")
router.HandleFunc("/auths/{auth_id:[a-zA-Z0-9-_]{1,255}}/keyids", apiStatsMiddleware(ag.handleGetAuthKeyIDs, "http.api.getauthkeyids", stats)).Methods("GET")
if os.Getenv("AUTOGRAPH_PROFILE") == "1" {
err = setRuntimeConfig()
if err != nil {
log.Fatal(err)
}
addProfilerHandlers(router)
log.Infof("enabled HTTP perf profiler")
}

// For each signer with a local chain upload location (eg: using the file
// scheme) create an handler to serve that directory at the path /x5u/keyid/
Expand All @@ -264,6 +256,16 @@ func run(conf configuration, listen string, debug bool) {
go func() {
mux := mux.NewRouter()
mux.Handle("/metrics", promhttp.Handler())

if os.Getenv("AUTOGRAPH_PROFILE") == "1" {
err = setRuntimeConfig()
if err != nil {
log.Fatal(err)
}
addProfilerHandlers(router)
log.Infof("enabled HTTP perf profiler")
}

srv := http.Server{
Addr: conf.DebugServer.Listen,
IdleTimeout: conf.Server.IdleTimeout,
Expand Down

0 comments on commit eb8f7fe

Please sign in to comment.