Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAuthenticationHandler ¶ added in v0.12.0
NewAuthenticationHandler returns an http middleware that invokes the given authenticator and calls the next handler in the middleware chain, with the authenticated actor added to the request context.
If the authenticator returns an error, then the overall http request is failed with an Unauthorized code.
func TraceHandler ¶
TraceHandler is a mux.MiddlewareFunc which creates a span with the route's name, as set by (mux.*Route).Name(), embeds it in the request context, and invokes the next middleware in the chain.
It also annotates the span with the route_path_template, if it exists, and the route_uri. To add additional spans, extract the span in your VTAdminHTTPHandler like:
func Handler(ctx context.Context, r Request, api *API) *JSONResponse { span, _ := trace.FromContext(ctx) span.Annotate("foo", "bar") return NewJSONResponse(api.Something(ctx)) }
An unnamed route will get a span named "vtadmin:http:<unnamed route>".
Types ¶
This section is empty.