Back to godoc.org

Package apmhttprouter

v0.5.2
Latest Go to latest

The latest major version is .

Published: Sep 20, 2018 | License: Apache-2.0 | Module: github.com/elastic/apm-agent-go

Index

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.

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

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

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

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

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

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

func (*Router) GET

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

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

func (*Router) HEAD

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

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

func (*Router) Handle

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

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

func (*Router) Handler

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

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

func (*Router) HandlerFunc

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

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

func (*Router) OPTIONS

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

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

func (*Router) PATCH

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

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

func (*Router) POST

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

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

func (*Router) PUT

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

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

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier