middleware

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2018 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RequestIDHeader is a constant containing the request header key
	RequestIDHeader = "X-Request-ID"

	// RequestCtxKey is a context containing the context key under which the
	// request ID is stored.
	RequestCtxKey = contextKey("requestID")
)

Variables

This section is empty.

Functions

func MetricsMiddleware added in v0.2.2

func MetricsMiddleware(next http.Handler) http.Handler

MetricsMiddleware is a net.http compatible middleware that captures some metrics about every request which we then expose via prometheus.

func RequestIDMiddleware

func RequestIDMiddleware(next http.Handler) http.Handler

RequestIDMiddleware is a net.http middleware that adds a unique UUID request ID to requests. If a request ID is already present in the request we use that one else we generate a random UUID. The request ID is added to our context so will be available within any downstream handlers.

Types

This section is empty.

Jump to

Keyboard shortcuts

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