Categorygithub.com/plainbanana/echo-pprof
modulepackage
0.2.0
Repository: https://github.com/plainbanana/echo-pprof.git
Documentation: pkg.go.dev

# README

echo-pprof

A wrapper for golang web framework echo to use net/http/pprof easily. Support Echo v4

Install

First install echo-pprof to your GOPATH using go get:

go get github.com/plainbanana/echo-pprof

Usage

package main

import (
	"github.com/labstack/echo/v4"
	"github.com/plainbanana/echo-pprof"
)

func main() {
	e := echo.New()

	e.GET("/ping", func(c echo.Context) error {
		return c.String(200, "pong")
	})

	// automatically add routers for net/http/pprof
	// e.g. /debug/pprof, /debug/pprof/heap, etc.
	echopprof.Wrap(e)

	// echopprof also plays well with *echo.Group
	// prefix := "/debug/pprof"
	// group := e.Group(prefix)
	// echopprof.WrapGroup(prefix, group)

	e.Start(":8080")
}

Start this server, and then visit http://127.0.0.1:8080/debug/pprof/ and you'll see what you want.

Have Fun.

# Functions

BlockHandler will pass the call from /debug/pprof/block to pprof.
CmdlineHandler will pass the call from /debug/pprof/cmdline to pprof.
GoroutineHandler will pass the call from /debug/pprof/goroutine to pprof.
HeapHandler will pass the call from /debug/pprof/heap to pprof.
IndexHandler will pass the call from /debug/pprof to pprof.
MutexHandler will pass the call from /debug/pprof/mutex to pprof.
ProfileHandler will pass the call from /debug/pprof/profile to pprof.
SymbolHandler will pass the call from /debug/pprof/symbol to pprof.
ThreadCreateHandler will pass the call from /debug/pprof/threadcreate to pprof.
TraceHandler will pass the call from /debug/pprof/trace to pprof.
Wrap adds several routes from package `net/http/pprof` to *echo.Echo object.
WrapGroup adds several routes from package `net/http/pprof` to *echo.Group object.

# Variables

Wrapper make sure we are backward compatible.