Skip to content

Latest commit

 

History

History

debug

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

http_debug

import "github.com/improbable-eng/go-httpwares/tracing/debug"

http_debug adds /debug/request debugging information for HTTP requests.

Debug Wares

This adds /debug/request information for client-side and server-side HTTP APIs.

This utilises the x/net/trace handlers that allow you to trace old requests.

doc.go middleware.go options.go tripperware.go

func DefaultIsStatusCodeAnError(statusCode int) bool

DefaultIsStatusCodeAnError defines a function that says whether a given request is an error based on a code.

func Middleware(opts ...Option) httpwares.Middleware

Middleware returns a http.Handler middleware that writes inbound requests to /debug/request.

The data logged will be: request headers, request ctxtags, response headers and response length.

func Tripperware(opts ...Option) httpwares.Tripperware

Tripperware returns a piece of client-side Tripperware that puts requests on the /debug/requests page.

The data logged will be: request headers, request ctxtags, response headers and response length.

type FilterFunc func(req *http.Request) bool

FilterFunc allows users to provide a function that filters out certain methods from being traced.

If it returns false, the given request will not be traced.

type IsStatusCodeAnErrorFunc func(statusCode int) bool

IsStatusCodeAnErrorFunc allows the customization of which requests are considered errors in the tracing system.

type Option func(*options)
func WithFilterFunc(f FilterFunc) Option

WithFilterFunc customizes the function used for deciding whether a given call is traced or not.

func WithIsStatusCodeAnError(f IsStatusCodeAnErrorFunc) Option

WithIsStatusCodeAnError customizes the function used for deciding whether a given call was an error


Generated by godoc2ghmd