apmhttprouter

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wrap

func Wrap(h httprouter.Handle, route string, o ...Option) httprouter.Handle

Wrap wraps h such that it will report requests as transactions to Elastic APM, using route in the transaction name.

By default, the returned Handle will use elasticapm.DefaultTracer. Use WithTracer to specify an alternative tracer.

By default, the returned Handle will recover panics, reporting them to the configured tracer. To override this behaviour, use WithRecovery.

Types

type Option

type Option func(*options)

Option sets options for tracing.

func WithRecovery

func WithRecovery(r apmhttp.RecoveryFunc) Option

WithRecovery returns an Option which sets r as the recovery function to use for tracing server requests.

func WithRequestIgnorer added in v0.5.0

func WithRequestIgnorer(r apmhttp.RequestIgnorerFunc) Option

WithRequestIgnorer returns a Option which sets r as the function to use to determine whether or not a request should be ignored. If r is nil, all requests will be reported.

func WithTracer

func WithTracer(t *elasticapm.Tracer) Option

WithTracer returns an Option which sets t as the tracer to use for tracing server requests.

type Router added in v0.5.0

type Router struct {
	*httprouter.Router
	// contains filtered or unexported fields
}

Router wraps an httprouter.Router, instrumenting all added routes except static content served with ServeFiles.

func New added in v0.5.0

func New(o ...Option) *Router

New returns a new Router which will instrument all added routes except static content served with ServeFiles.

func (*Router) DELETE added in v0.5.0

func (r *Router) DELETE(path string, handle httprouter.Handle)

DELETE calls r.Router.DELETE with a wrapped handler.

func (*Router) GET added in v0.5.0

func (r *Router) GET(path string, handle httprouter.Handle)

GET calls r.Router.GET with a wrapped handler.

func (*Router) HEAD added in v0.5.0

func (r *Router) HEAD(path string, handle httprouter.Handle)

HEAD calls r.Router.HEAD with a wrapped handler.

func (*Router) Handle added in v0.5.0

func (r *Router) Handle(method, path string, handle httprouter.Handle)

Handle calls r.Router.Handle with a wrapped handler.

func (*Router) Handler added in v0.5.0

func (r *Router) Handler(method, path string, handler http.Handler)

Handler is equivalent to r.Router.Handler, but traces requests.

func (*Router) HandlerFunc added in v0.5.0

func (r *Router) HandlerFunc(method, path string, handler http.HandlerFunc)

HandlerFunc is equivalent to r.Router.HandlerFunc, but traces requests.

func (*Router) OPTIONS added in v0.5.0

func (r *Router) OPTIONS(path string, handle httprouter.Handle)

OPTIONS is equivalent to r.Router.OPTIONS, but traces requests.

func (*Router) PATCH added in v0.5.0

func (r *Router) PATCH(path string, handle httprouter.Handle)

PATCH is equivalent to r.Router.PATCH, but traces requests.

func (*Router) POST added in v0.5.0

func (r *Router) POST(path string, handle httprouter.Handle)

POST is equivalent to r.Router.POST, but traces requests.

func (*Router) PUT added in v0.5.0

func (r *Router) PUT(path string, handle httprouter.Handle)

PUT is equivalent to r.Router.PUT, but traces requests.

Jump to

Keyboard shortcuts

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