feat: add prometheus metrics
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2m16s
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2m16s
This commit is contained in:
4
main.go
4
main.go
@@ -7,6 +7,7 @@ import (
|
||||
"go-example/hello"
|
||||
"net/http"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
@@ -21,7 +22,8 @@ func main() {
|
||||
flag.Parse()
|
||||
conf.Init(*configPath)
|
||||
|
||||
http.HandleFunc("/hello", hello.Handler)
|
||||
http.HandleFunc("/hello", hello.Middleware(hello.Handler))
|
||||
http.Handle("/metrics", promhttp.Handler())
|
||||
|
||||
port := viper.GetInt("server.port")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user