How to disable go_collector metrics in prometheus/client_golang
Well the topic is rather old but in case others have to deal with it. The following code works fine with current codebase v0.9.0-pre1
// [...] imports, metric initialization ...
func main() {
// go get rid of any additional metrics
// we have to expose our metrics with a custom registry
r := prometheus.NewRegistry()
r.MustRegister(myMetrics)
handler := promhttp.HandlerFor(r, promhttp.HandlerOpts{})
// [...] update metrics within a goroutine
http.Handle("/metrics", handler)
log.Fatal(http.ListenAndServe(":12345", nil))
}