Documentation ¶
Overview ¶
Package dump provides the endpoint "debug/dump", registered with http.DefaultServeMux, which returns a dump of useful diagnostic information as a tarball. The base configuration includes several useful diagnostics (see init). You may also register your own dump parts to be included, e.g.:
Register("mystuff", func(ctx context.Context, w io.Writer) error { w.Write([]byte("mystuff diagnostic data")) return nil })
The endpoint responds with a gzipped tarball. The Content-Disposition of the response suggests a pseudo-unique filename to make it easier to deal with multiple dumps. Use curl flags to accept the suggested filename (recommended).
curl -OJ http://example:1234/debug/dump
Note that it will take at least 30 seconds to respond, as some of the parts of the base configuration are 30-second profiles.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultRegistry = NewRegistry(readExec())
DefaultRegistry is a default registry that has this process's GUID as its ID.
var ErrSkipPart = errors.New("skip part")
ErrSkipPart signals that we should skip a part. Return this from your Func to silently ignore the part for the current dump. If your Func returns anything else non-nil, it will be logged as an error. This is mostly useful for keeping logs quiet for parts that are sometimes unavailable for non-error reasons.
Functions ¶
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry maintains the set of parts that will compose the dump.
func NewRegistry ¶
NewRegistry returns a new registry for the parts to be included in the dump.
func (*Registry) Name ¶
Name returns a name for reg that is convenient for naming dump files, as it is pseudo-unique and includes the registry ID, the time at which the registry was created, and the duration from that creation time.
func (*Registry) Register ¶
Register registers a new part to be included in the dump of reg. Name will become the filename of the part file in the dump tarball. Func f will be called to produce the contents of that file.
func (*Registry) ServeHTTP ¶
func (reg *Registry) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP serves the dump with a Content-Disposition set with a unique filename.