reporter

package
v1.0.0-beta.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2017 License: Apache-2.0 Imports: 9 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 SetErrorHeaders

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

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

func Tripperware

func Tripperware(next http.RoundTripper) http.RoundTripper

Tripperware ensures that we are consisent in kedge response: If request was not proxied (error inside kedge flow), we add response Headers saying what happened.

Types

type Tracker

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

Tracker is used to report an kedge error (error that happen when request was not proxied because of some reason). It covers only last seen error, so ReportError is required to be reporter only once, at the end of handler or reverse proxy tripperware.

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) 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