http_debug

package
v0.0.0-...-f9d81f5 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

`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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultIsStatusCodeAnError

func DefaultIsStatusCodeAnError(statusCode int) bool

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

func Middleware

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

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.

Types

type FilterFunc

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

type IsStatusCodeAnErrorFunc func(statusCode int) bool

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

type Option

type Option func(*options)

func WithFilterFunc

func WithFilterFunc(f FilterFunc) Option

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

func WithIsStatusCodeAnError

func WithIsStatusCodeAnError(f IsStatusCodeAnErrorFunc) Option

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

Jump to

Keyboard shortcuts

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