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 ¶
ReqWrappedWithTracker returns copy of HTTP request with tracker in context.
func SetErrorHeaders ¶
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 ¶
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.