Documentation
¶
Overview ¶
Package debug provides debug helpers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Index ¶
func Index(cfg RouterConfig) *chi.Mux
Index is a http handler that provides a page with debug tools.
func Links ¶
func Links(links map[string]string) func(config *RouterConfig)
Links adds a map of href to title to show in debug index.
func Prefix ¶
func Prefix(prefix string) func(config *RouterConfig)
Prefix is a DebugHandler option.
Types ¶
type Config ¶
type Config struct {
// TraceSamplingProbability is probability of exporting of OpenCensus trace.
TraceSamplingProbability float64 `split_words:"true" default:"0.1"`
// TraceURL allows providing URL to {trace_id}, example http://jaeger.myservice.com/trace/{trace_id}.
TraceURL string `split_words:"true"`
// DevTools enables developer tools for documentation and debug.
DevTools bool `split_words:"true" default:"true"`
// RouterConfig allows control of developer tools router.
RouterConfig []func(options *RouterConfig) `ignored:"true"`
// DevPassword enables password protection for dev tools.
DevPassword string `split_words:"true"`
// URL used as an entry point to mount dev tools debug router.
URL string `split_words:"true" default:"/debug"`
// ExposePanics allows showing panic messages and traces in API response.
ExposePanics bool `split_words:"true"`
OnPanic []func(ctx context.Context, rcv interface{}, stack []byte) `ignored:"true"`
}
Config keeps debug settings.
type RouterConfig ¶
type RouterConfig struct {
// Prefix sets mounting path for debug index page, default "/debug".
Prefix string
// Links is an additional map of href to title to show in debug index.
Links map[string]string
// Routes are executed on debug router.
Routes []func(r *chi.Mux)
// TraceToURL allows converting sampled trace ids into clickable links using function result as URL.
// URL may point to Jaeger UI for example.
TraceToURL func(traceID string) string
}
RouterConfig defines debug tools router options.
Click to show internal directories.
Click to hide internal directories.