Integrate Go with Grafana by exposing metrics via the runtime/pprof package and configuring Grafana to scrape the /debug/pprof endpoint.
import _ "net/http/pprof"
func main() {
go func() {
// Exposes /debug/pprof/profile, /debug/pprof/heap, etc.
http.ListenAndServe("localhost:6060", nil)
}()
// Your application logic here
}
In Grafana, add a Prometheus data source pointing to your Go app's metrics endpoint, then create a dashboard panel querying the go_goroutines, go_memstats_alloc_bytes, or process_cpu_seconds_total metrics.