-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PRT-140: portal memory is increasing over time check why what do we c…
…ache and forget to release see image addded (#190) * PRT-140 - support for pprof server (still got err bug) * PRT-140 - used fiber instead of http * PRT-140: fixed lint issues * PRT-140: enabled gofumpt in pprofServer.go * PRT-140: optional address flag, remove default values
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package performance | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/gofiber/fiber/v2" | ||
fiberpprof "github.com/gofiber/fiber/v2/middleware/pprof" | ||
"github.com/lavanet/lava/utils" | ||
) | ||
|
||
const ( | ||
PprofAddressFlagName = "pprof-address" | ||
) | ||
|
||
func StartPprofServer(addr string) error { | ||
// Set up the Fiber app | ||
app := fiber.New() | ||
|
||
// Let the fiber HTTP server use pprof | ||
app.Use(fiberpprof.New()) | ||
|
||
// Start the HTTP server in a goroutine | ||
go func() { | ||
fmt.Printf("Starting server on %s\n", addr) | ||
if err := app.Listen(addr); err != nil { | ||
fmt.Printf("Error starting pprof HTTP server: %s\n", err) | ||
} | ||
}() | ||
|
||
utils.LavaFormatInfo("start pprof HTTP server", &map[string]string{"IPAddress": addr}) | ||
|
||
return nil | ||
} |