Skip to content

Commit a877192

Browse files
authored
remove pprof endpoint (#260)
1 parent 95f77b0 commit a877192

File tree

1 file changed

+0
-23
lines changed
  • cmd/amazon-cloudwatch-agent-target-allocator/server

1 file changed

+0
-23
lines changed

cmd/amazon-cloudwatch-agent-target-allocator/server/server.go

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ import (
99
"encoding/json"
1010
"fmt"
1111
"net/http"
12-
"net/http/pprof"
1312
"net/url"
14-
"strings"
1513
"sync"
1614
"time"
1715

@@ -90,7 +88,6 @@ func (s *Server) setRouter(router *gin.Engine) {
9088
router.GET("/metrics", gin.WrapH(promhttp.Handler()))
9189
router.GET("/livez", s.LivenessProbeHandler)
9290
router.GET("/readyz", s.ReadinessProbeHandler)
93-
registerPprof(router.Group("/debug/pprof/"))
9491
}
9592

9693
func NewServer(log logr.Logger, allocator allocation.Allocator, listenAddr string, options ...Option) *Server {
@@ -316,23 +313,3 @@ func GetAllTargetsByJob(allocator allocation.Allocator, job string) map[string]c
316313
}
317314
return displayData
318315
}
319-
320-
// registerPprof registers the pprof handlers and either serves the requested
321-
// specific profile or falls back to index handler.
322-
func registerPprof(g *gin.RouterGroup) {
323-
g.GET("/*profile", func(c *gin.Context) {
324-
path := c.Param("profile")
325-
switch strings.TrimPrefix(path, "/") {
326-
case "cmdline":
327-
gin.WrapF(pprof.Cmdline)(c)
328-
case "profile":
329-
gin.WrapF(pprof.Profile)(c)
330-
case "symbol":
331-
gin.WrapF(pprof.Symbol)(c)
332-
case "trace":
333-
gin.WrapF(pprof.Trace)(c)
334-
default:
335-
gin.WrapF(pprof.Index)(c)
336-
}
337-
})
338-
}

0 commit comments

Comments
 (0)