GabhenDM / echo-pprof

echo-pprof is a wrapper for golang web framework echo to use net/http/pprof easily.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

echo-pprof

A fork of the original echo-pprof project, updated to support Echo v4 and utilizing go modules.

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

Install

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

go get -u github.com/GabhenDM/echo-pprof/v2

Usage

package main

import (
	echopprof "github.com/GabhenDM/echo-pprof/v2"
	"github.com/labstack/echo/v4"
)

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.

Credits to sevennt for the original wrapper.

About

echo-pprof is a wrapper for golang web framework echo to use net/http/pprof easily.

License:MIT License


Languages

Language:Go 100.0%