Documentation ¶
Index ¶
- Variables
- func GetEmail(ctx context.Context) string
- func GetGroups(ctx context.Context) ([]string, error)
- func PskValidatorMiddleware(keys []string) func(next http.Handler) http.Handler
- func RequestLogFields(r *http.Request) log.Fields
- func RequestLogger() func(next http.Handler) http.Handler
- func WithEmail(ctx context.Context, email string) context.Context
- func WithGroups(ctx context.Context, groups []string) context.Context
- type Middleware
Constants ¶
This section is empty.
Variables ¶
View Source
var LogEntryCtxKey = &contextKey{"LogEntry"}
LogEntryCtxKey is the context.Context key to store the request log entry.
Functions ¶
func PskValidatorMiddleware ¶
func RequestLogFields ¶
RequestLogFields returns the in-context LogEntry for a request.
func RequestLogger ¶
RequestLogger returns a logger handler using a custom LogFormatter.
Types ¶
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
Middleware is a handler that exposes prometheus metrics for the number of requests, the latency and the response size, partitioned by status code, method and HTTP path.
func PrometheusMiddleware ¶
func PrometheusMiddleware(name string, buckets ...float64) *Middleware
NewMiddleware returns a new prometheus Middleware handler.
func (*Middleware) Handler ¶
func (m *Middleware) Handler() middleware
func (*Middleware) Initialize ¶
func (m *Middleware) Initialize(path, method string, code int)
Click to show internal directories.
Click to hide internal directories.