id: fgprof
Fgprof
![Linter](https://github.com/gofiber/contrib/workflows/Linter/badge.svg)
fgprof support for Fiber.
Note: Requires Go 1.19 and above
Install
This middleware supports Fiber v2.
Using fgprof to profiling your Fiber app.
go get -u github.com/gofiber/fiber/v2
go get -u github.com/gofiber/contrib/fgprof
Config
Property |
Type |
Description |
Default |
Next |
func(c *fiber.Ctx) bool |
A function to skip this middleware when returned true . |
nil |
Prefix |
string . |
Prefix defines a URL prefix added before "/debug/fgprof". Note that it should start with (but not end with) a slash. Example: "/federated-fiber" |
"" |
Example
package main
import (
"log"
"github.com/gofiber/contrib/fgprof"
"github.com/gofiber/fiber/v2"
)
func main() {
app := fiber.New()
app.Use(fgprof.New())
app.Get("/", func(c *fiber.Ctx) error {
return c.SendString("OK")
})
log.Fatal(app.Listen(":3000"))
}
go tool pprof -http=:8080 http://localhost:3000/debug/fgprof