From 437fd5d8a64045af48fbeff7fee8b529d8ef6edc Mon Sep 17 00:00:00 2001 From: nogo <0xnogo@gmail.com> Date: Fri, 6 Dec 2024 15:14:50 +0400 Subject: [PATCH 1/2] heap --- core/web/router.go | 1 + 1 file changed, 1 insertion(+) diff --git a/core/web/router.go b/core/web/router.go index 6e96b47981b..62e74b926cd 100644 --- a/core/web/router.go +++ b/core/web/router.go @@ -189,6 +189,7 @@ func metricRoutes(r *gin.RouterGroup, includeHeap bool) { pprofGroup.GET("/allocs", ginHandlerFromHTTP(pprof.Handler("allocs").ServeHTTP)) pprofGroup.GET("/block", ginHandlerFromHTTP(pprof.Handler("block").ServeHTTP)) pprofGroup.GET("/goroutine", ginHandlerFromHTTP(pprof.Handler("goroutine").ServeHTTP)) + includeHeap = true if includeHeap { pprofGroup.GET("/heap", ginHandlerFromHTTP(pprof.Handler("heap").ServeHTTP)) } From b8a61f14d62e1f5d3566e5369227aa0979cb59cd Mon Sep 17 00:00:00 2001 From: nogo <0xnogo@gmail.com> Date: Fri, 6 Dec 2024 15:26:47 +0400 Subject: [PATCH 2/2] lint --- core/web/router.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/core/web/router.go b/core/web/router.go index 62e74b926cd..5a412595e0c 100644 --- a/core/web/router.go +++ b/core/web/router.go @@ -35,7 +35,6 @@ import ( "go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin" "go.opentelemetry.io/otel" - "github.com/smartcontractkit/chainlink/v2/core/build" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/v2/core/web/auth" @@ -178,7 +177,7 @@ func debugRoutes(app chainlink.Application, r *gin.RouterGroup) { group.GET("/vars", expvar.Handler()) } -func metricRoutes(r *gin.RouterGroup, includeHeap bool) { +func metricRoutes(r *gin.RouterGroup) { pprofGroup := r.Group("/debug/pprof") pprofGroup.GET("/", ginHandlerFromHTTP(pprof.Index)) pprofGroup.GET("/cmdline", ginHandlerFromHTTP(pprof.Cmdline)) @@ -189,10 +188,7 @@ func metricRoutes(r *gin.RouterGroup, includeHeap bool) { pprofGroup.GET("/allocs", ginHandlerFromHTTP(pprof.Handler("allocs").ServeHTTP)) pprofGroup.GET("/block", ginHandlerFromHTTP(pprof.Handler("block").ServeHTTP)) pprofGroup.GET("/goroutine", ginHandlerFromHTTP(pprof.Handler("goroutine").ServeHTTP)) - includeHeap = true - if includeHeap { - pprofGroup.GET("/heap", ginHandlerFromHTTP(pprof.Handler("heap").ServeHTTP)) - } + pprofGroup.GET("/heap", ginHandlerFromHTTP(pprof.Handler("heap").ServeHTTP)) pprofGroup.GET("/mutex", ginHandlerFromHTTP(pprof.Handler("mutex").ServeHTTP)) pprofGroup.GET("/threadcreate", ginHandlerFromHTTP(pprof.Handler("threadcreate").ServeHTTP)) } @@ -431,7 +427,7 @@ func v2Routes(app chainlink.Application, r *gin.RouterGroup) { authv2.GET("/build_info", buildInfo.Show) // Debug routes accessible via authentication - metricRoutes(authv2, build.IsDev()) + metricRoutes(authv2) } ping := PingController{app}