reporter

package
v1.0.0-beta.test.7 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(logger logrus.FieldLogger) httpwares.Middleware

Middleware reports last Kedge proxy error on each HTTP request (if spotted) by incrementing metrics and producing log line.

func ReqWrappedWithTracker

func ReqWrappedWithTracker(req *http.Request, t *Tracker) *http.Request

ReqWrappedWithTracker returns copy of HTTP request with tracker in context.

func SetKedgeErrorHeaders

func SetKedgeErrorHeaders(headerMap http.Header, t *Tracker)

SetKedgeErrorHeaders adds Kedge Error headers useful to immediately see kedge error on HTTP response. NOTE: This method can be invoked only before resp.WriteHeader(...)

func SetWinchErrorHeaders

func SetWinchErrorHeaders(headerMap http.Header, t *Tracker)

SetWinchErrorHeaders adds winch Error headers useful to immediately see winch error on HTTP response. NOTE: This method can be invoked only before resp.WriteHeader(...)

Types

type Tracker

type Tracker struct {
	// contains filtered or unexported fields
}

Tracker is used to report an error spotted by kedge itself (error that happen when request was not succesfully proxied because of some reason). It covers only first seen error and warns when ReportError is called twice on the same request.

For Kedge flow there will be only one tracker living for each request shared by both handler and reverse proxy tripperwares. This is thanks of reverse proxy preserving request's context.

func Extract

func Extract(req *http.Request) *Tracker

ExtractInbound returns existing tracker or does lazy creation of new one to be used. NOTE that still reqWrappedWithTracker function needs to be invoked to save this tracker into request's context. This is due to cost of copying context and request around to just add a value to context.

func (*Tracker) ErrType

func (t *Tracker) ErrType() errtypes.Type

func (*Tracker) Error

func (t *Tracker) Error() (errtypes.Type, error)

func (*Tracker) ReportError

func (t *Tracker) ReportError(errType errtypes.Type, err error)

ReportError reports kedge proxy error.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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