From d838d283d8ad4b2686b6d4a5eaa4fb3ce5f08085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E6=B8=90=E7=A6=BB?= Date: Mon, 13 Jan 2025 17:41:35 +0000 Subject: [PATCH] add prometheus metrics --- router.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/router.go b/router.go index 28666d3..c848096 100755 --- a/router.go +++ b/router.go @@ -22,6 +22,8 @@ import ( "github.com/PBH-BTN/trunker/biz/handler" "github.com/PBH-BTN/trunker/biz/router" "github.com/cloudwego/hertz/pkg/app/server" + "github.com/hertz-contrib/pprof/adaptor" + "github.com/prometheus/client_golang/prometheus/promhttp" ) // customizeRegister registers customize routers. @@ -30,5 +32,6 @@ func customizedRegister(r *server.Hertz) { r.GET("/announce", handler.Announce) r.GET("/scrape", handler.Scrape) router.RegisterAdminRouter(r) + r.GET("/pprof_metrics", adaptor.NewHertzHTTPHandler(promhttp.Handler())) // your code ... }