Skip to content

Commit

Permalink
Merge pull request #3244 from jamsman94/cp/3243
Browse files Browse the repository at this point in the history
cherrypick #3243
  • Loading branch information
jamsman94 authored Dec 11, 2023
2 parents 60d76a4 + 61bdaf9 commit 048e69f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions pkg/microservice/aslan/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
_ "net/http/pprof"
"time"

"github.com/gorilla/mux"
"github.com/koderover/zadig/pkg/microservice/aslan/core"
"github.com/koderover/zadig/pkg/microservice/aslan/server/rest"
"github.com/koderover/zadig/pkg/tool/kube/client"
Expand Down Expand Up @@ -66,13 +67,14 @@ func Serve(ctx context.Context) error {

// pprof service, you can access it by {your_ip}:8888/debug/pprof
go func() {
mux := http.NewServeMux()
mux.HandleFunc("/api/debug/pprof", pprof.Index)
mux.HandleFunc("/api/debug/pprof/cmdline", pprof.Cmdline)
mux.HandleFunc("/api/debug/pprof/profile", pprof.Profile)
mux.HandleFunc("/api/debug/pprof/symbol", pprof.Symbol)
mux.HandleFunc("/api/debug/pprof/trace", pprof.Trace)
err := http.ListenAndServe("0.0.0.0:8888", mux)
router := mux.NewRouter()
router.Handle("/debug/pprof", http.HandlerFunc(pprof.Index))
router.Handle("/debug/pprof/cmdline", http.HandlerFunc(pprof.Cmdline))
router.Handle("/debug/pprof/profile", http.HandlerFunc(pprof.Profile))
router.Handle("/debug/pprof/symbol", http.HandlerFunc(pprof.Symbol))
router.Handle("/debug/pprof/trace", http.HandlerFunc(pprof.Trace))
router.Handle("/debug/pprof/{cmd}", http.HandlerFunc(pprof.Index))
err := http.ListenAndServe("0.0.0.0:8888", router)
if err != nil {
log.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/microservice/user/core/service/permission/authn.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func IsPublicURL(reqPath, method string) bool {
return true
}

if strings.HasPrefix(realPath, "/api/debug/pprof") && method == http.MethodGet {
if strings.HasPrefix(realPath, "/debug") && method == http.MethodGet {
return true
}

Expand Down

0 comments on commit 048e69f

Please sign in to comment.