in tools/fake-webserver/main.go [49:78]
func main() {
flag.Parse()
if *registerProcessMetrics {
registry.MustRegister(collectors.NewProcessCollector(collectors.ProcessCollectorOpts{}))
}
if *registerGoMetrics {
registry.MustRegister(collectors.NewGoCollector())
}
for i := 0; i < *n; i++ {
mux := http.NewServeMux()
mux.Handle("/debug/pprof/", http.HandlerFunc(pprof.Index))
mux.Handle("/debug/pprof/cmdline", http.HandlerFunc(pprof.Cmdline))
mux.Handle("/debug/pprof/profile", http.HandlerFunc(pprof.Profile))
mux.Handle("/debug/pprof/symbol", http.HandlerFunc(pprof.Symbol))
mux.Handle("/debug/pprof/trace", http.HandlerFunc(pprof.Trace))
mux.Handle("/metrics", promhttp.HandlerFor(
registry,
promhttp.HandlerOpts{
DisableCompression: !*allowCompression,
},
))
go func(i int) {
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", 8080+i), mux))
}(i)
}
runClient()
}