prof

package
v1.0.55 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: MIT Imports: 3 Imported by: 0

README

prof

Wrap the official net/http/pprof route and add the profile io wait time route.


Example of use

    import "github.com/18721889353/sunshine/pkg/gin/prof"

	r := gin.Default()
	prof.Register(r, WithPrefix("/myServer"), WithIOWaitTime())

	httpServer := &http.Server{
		Addr:    ":8080",
		Handler: r,
	}
	
    if err := httpServer.ListenAndServe(); err != nil && err != http.ErrServerClosed {
        panic("listen and serve error: " + err.Error())
    }

Documentation

Overview

Package prof is used for gin profiling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(r *gin.Engine, opts ...Option)

Register pprof for gin router

Types

type Option

type Option func(o *options)

Option set defaultPrefix func

func WithIOWaitTime

func WithIOWaitTime() Option

WithIOWaitTime enable IO wait time

func WithPrefix

func WithPrefix(prefix string) Option

WithPrefix set route defaultPrefix

Jump to

Keyboard shortcuts

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