diff --git a/cmd/service/api.go b/cmd/service/api.go index d1c90a4..fafa802 100644 --- a/cmd/service/api.go +++ b/cmd/service/api.go @@ -3,6 +3,7 @@ package main import ( "github.com/VictoriaMetrics/metrics" "github.com/labstack/echo/v4" + echopprof "github.com/sevenNt/echo-pprof" ) func initApiServer() *echo.Echo { @@ -17,5 +18,9 @@ func initApiServer() *echo.Echo { }) } + if debugFlag { + echopprof.Wrap(server) + } + return server } diff --git a/go.mod b/go.mod index a163155..0432150 100644 --- a/go.mod +++ b/go.mod @@ -15,6 +15,7 @@ require ( github.com/knadh/koanf/v2 v2.0.0 github.com/labstack/echo/v4 v4.10.2 github.com/nats-io/nats.go v1.24.0 + github.com/sevenNt/echo-pprof v0.1.1-0.20230131020615-4dd36891e14b github.com/stretchr/testify v1.8.2 github.com/zerodha/logf v0.5.5 ) diff --git a/go.sum b/go.sum index ab338b2..6853260 100644 --- a/go.sum +++ b/go.sum @@ -555,6 +555,8 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/sevenNt/echo-pprof v0.1.1-0.20230131020615-4dd36891e14b h1:IXGKwQZ6+llGbDFyTJvBXWGTkfrAqsbYwtVVm+Ax4WU= +github.com/sevenNt/echo-pprof v0.1.1-0.20230131020615-4dd36891e14b/go.mod h1:ArUb+H7+Tew7UUjK6x2xiAqFrznLrANIfz9M6m66J0c= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=