-
Notifications
You must be signed in to change notification settings - Fork 699
/
admin.go
27 lines (24 loc) · 965 Bytes
/
admin.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package router
import (
"net/http"
"net/http/pprof"
"time"
"github.com/prebid/prebid-server/currency"
"github.com/prebid/prebid-server/endpoints"
"github.com/prebid/prebid-server/version"
)
func Admin(rateConverter *currency.RateConverter, rateConverterFetchingInterval time.Duration) *http.ServeMux {
// Add endpoints to the admin server
// Making sure to add pprof routes
mux := http.NewServeMux()
// Register pprof handlers
mux.HandleFunc("/debug/pprof/", pprof.Index)
mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
mux.HandleFunc("/debug/pprof/trace", pprof.Trace)
// Register prebid-server defined admin handlers
mux.HandleFunc("/currency/rates", endpoints.NewCurrencyRatesEndpoint(rateConverter, rateConverterFetchingInterval))
mux.HandleFunc("/version", endpoints.NewVersionEndpoint(version.Ver, version.Rev))
return mux
}