How to Integrate Go with Grafana Dashboards

Integrate Go with Grafana by enabling the built-in pprof HTTP handler and configuring Grafana to scrape the resulting metrics endpoint.

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.