roundtripware

package
v0.9.12 Latest Latest
Warning

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

Go to latest
Published: May 9, 2022 License: MIT Imports: 17 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LabelerFromContext added in v0.9.12

func LabelerFromContext(ctx context.Context) (context.Context, *otelhttp.Labeler)

LabelerFromContext retrieves a Labeler instance from the provided context if one is available. If no Labeler was found in the provided context a new, empty Labeler is returned and the second return value is false. In this case it is safe to use the Labeler but any attributes added to it will not be used.

Types

type Handler

type Handler func(r *http.Request) (*http.Response, error)

type RecoverOption

type RecoverOption func(options *RecoverOptions)

func RecoverWithDisablePrintStack

func RecoverWithDisablePrintStack(v bool) RecoverOption

RecoverWithDisablePrintStack roundTripware option

type RecoverOptions

type RecoverOptions struct {
	DisablePrintStack bool
}

func GetDefaultRecoverOptions

func GetDefaultRecoverOptions() RecoverOptions

GetDefaultRecoverOptions returns the default options

type RoundTripper

type RoundTripper struct {
	http.RoundTripper
	// contains filtered or unexported fields
}

func NewRoundTripper

func NewRoundTripper(l *zap.Logger, parent http.RoundTripper, roundTripwares ...RoundTripware) *RoundTripper

func (*RoundTripper) RoundTrip

func (rt *RoundTripper) RoundTrip(req *http.Request) (resp *http.Response, err error)

type RoundTripware

type RoundTripware func(l *zap.Logger, next Handler) Handler

func Dump added in v0.9.1

func Dump() RoundTripware

Dump returns a RoundTripper which prints out the request & response object

func DumpRequest

func DumpRequest() RoundTripware

DumpRequest returns a RoundTripper which prints out the request object

func DumpResponse

func DumpResponse() RoundTripware

DumpResponse returns a RoundTripper which prints out the response object

func Logger

func Logger() RoundTripware

Logger returns a RoundTripware which logs all requests

func Metric added in v0.9.12

func Metric(meter metric.Meter, name, description string) RoundTripware

Metric returns a RoundTripper which prints out the request & response object

func Recover

func Recover(opts ...RecoverOption) RoundTripware

Recover returns a RoundTripper which catches any panics

func RecoverWithOptions

func RecoverWithOptions(opts RecoverOptions) RoundTripware

RecoverWithOptions returns a RoundTripper which catches any panics

Jump to

Keyboard shortcuts

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