github.com/prebid/prebid-server/v2@v2.18.0/router/admin.go (about)

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