handlers

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TraceHandler

func TraceHandler(next http.Handler) http.Handler

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.

Jump to

Keyboard shortcuts

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