Fgprof


Fiber에서 사용 가능한 fgprof 지원입니다.

참고: Go 1.19 이상 버전이 필요합니다

Installation

이 미들웨어는 Fiber v2를 지원합니다.

fgprof를 사용하여 Fiber 앱을 프로파일링합니다.

go get -u github.com/gofiber/fiber/v2
go get -u github.com/gofiber/contrib/fgprof

Config

속성
타입
설명
기본값

Next

func(c *fiber.Ctx) bool

true를 반환하면 이 미들웨어를 건너뛰는 함수입니다.

nil

Prefix

string

"/debug/fgprof" 앞에 추가되는 URL 접두사를 정의합니다. 슬래시로 시작해야 하며(끝나면 안 됨) 예: "/federated-fiber"

""

Examples

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

Last updated