pprof

package
v2.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2026 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

Package pprof registers Go pprof handlers on an HTTP router.

RegisterRoutes wires profiling handlers only; it does not add authentication, authorization, or network restrictions. Prefer RegisterAdminRoutes for new admin mounts so an explicit wrapper is required at construction time.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterAdminRoutes added in v2.1.0

func RegisterAdminRoutes(r Router, requireAdmin func(http.Handler) http.Handler) error

RegisterAdminRoutes wires pprof handlers behind an explicit authorization or internal-network wrapper. Passing nil fails closed so admin-only mounts cannot accidentally expose pprof without policy.

func RegisterRoutes

func RegisterRoutes(r Router)

RegisterRoutes wires the default pprof handlers on the provided router. Deprecated: prefer RegisterAdminRoutes for new admin mounts so an explicit authorization or internal-network wrapper is required.

Types

type Router

type Router interface {
	Get(pattern string, h http.HandlerFunc)
}

Router defines the minimal GET registration contract needed for pprof routes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL