From 9f193618ecd5b5529628bb43b129e2965c3ea087 Mon Sep 17 00:00:00 2001 From: Yongbo Jiang Date: Wed, 25 Oct 2023 18:09:35 +0800 Subject: [PATCH] api: add audit log for pprof (#7250) ref tikv/pd#4480 Signed-off-by: Cabinfever_B Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com> --- server/api/router.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/server/api/router.go b/server/api/router.go index 93811e264f1..0473e3e1bf7 100644 --- a/server/api/router.go +++ b/server/api/router.go @@ -334,16 +334,16 @@ func createRouter(prefix string, svr *server.Server) *mux.Router { pprofHandler := newPprofHandler(svr, rd) // profile API - registerFunc(apiRouter, "/debug/pprof/profile", pprof.Profile) - registerFunc(apiRouter, "/debug/pprof/trace", pprof.Trace) - registerFunc(apiRouter, "/debug/pprof/symbol", pprof.Symbol) - registerFunc(apiRouter, "/debug/pprof/heap", pprofHandler.PProfHeap) - registerFunc(apiRouter, "/debug/pprof/mutex", pprofHandler.PProfMutex) - registerFunc(apiRouter, "/debug/pprof/allocs", pprofHandler.PProfAllocs) - registerFunc(apiRouter, "/debug/pprof/block", pprofHandler.PProfBlock) - registerFunc(apiRouter, "/debug/pprof/goroutine", pprofHandler.PProfGoroutine) - registerFunc(apiRouter, "/debug/pprof/threadcreate", pprofHandler.PProfThreadcreate) - registerFunc(apiRouter, "/debug/pprof/zip", pprofHandler.PProfZip) + registerFunc(apiRouter, "/debug/pprof/profile", pprof.Profile, setAuditBackend(localLog)) + registerFunc(apiRouter, "/debug/pprof/trace", pprof.Trace, setAuditBackend(localLog)) + registerFunc(apiRouter, "/debug/pprof/symbol", pprof.Symbol, setAuditBackend(localLog)) + registerFunc(apiRouter, "/debug/pprof/heap", pprofHandler.PProfHeap, setAuditBackend(localLog)) + registerFunc(apiRouter, "/debug/pprof/mutex", pprofHandler.PProfMutex, setAuditBackend(localLog)) + registerFunc(apiRouter, "/debug/pprof/allocs", pprofHandler.PProfAllocs, setAuditBackend(localLog)) + registerFunc(apiRouter, "/debug/pprof/block", pprofHandler.PProfBlock, setAuditBackend(localLog)) + registerFunc(apiRouter, "/debug/pprof/goroutine", pprofHandler.PProfGoroutine, setAuditBackend(localLog)) + registerFunc(apiRouter, "/debug/pprof/threadcreate", pprofHandler.PProfThreadcreate, setAuditBackend(localLog)) + registerFunc(apiRouter, "/debug/pprof/zip", pprofHandler.PProfZip, setAuditBackend(localLog)) // service GC safepoint API serviceGCSafepointHandler := newServiceGCSafepointHandler(svr, rd)