[PHASE-9] Expose runtime go metrics
This commit is contained in:
parent
64513deaf8
commit
2d8a7fae61
|
|
@ -18,6 +18,8 @@ import (
|
||||||
"hash-of-wisdom/internal/service"
|
"hash-of-wisdom/internal/service"
|
||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||||
|
"github.com/prometheus/client_golang/prometheus/collectors"
|
||||||
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
_ "net/http/pprof"
|
_ "net/http/pprof"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -64,6 +66,10 @@ func main() {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Register Go runtime metrics
|
||||||
|
prometheus.MustRegister(collectors.NewGoCollector())
|
||||||
|
prometheus.MustRegister(collectors.NewProcessCollector(collectors.ProcessCollectorOpts{}))
|
||||||
|
|
||||||
// Start metrics and pprof HTTP server
|
// Start metrics and pprof HTTP server
|
||||||
go func() {
|
go func() {
|
||||||
http.Handle("/metrics", promhttp.Handler())
|
http.Handle("/metrics", promhttp.Handler())
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue