apm-agent-go: github.com/elastic/apm-agent-go/module/apmhttprouter Index | Files

package apmhttprouter

import "github.com/elastic/apm-agent-go/module/apmhttprouter"

Index

Package Files

handler.go router.go

func Wrap Uses

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 apm.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.

func WrapMethodNotAllowedHandler Uses

func WrapMethodNotAllowedHandler(h http.Handler, o ...Option) http.Handler

WrapMethodNotAllowedHandler wraps h so that it is traced. If h is nil, then a default handler will be used that returns status code 405.

func WrapNotFoundHandler Uses

func WrapNotFoundHandler(h http.Handler, o ...Option) http.Handler

WrapNotFoundHandler wraps h so that it is traced. If h is nil, then http.NotFoundHandler() will be used.

type Option Uses

type Option func(*options)

Option sets options for tracing.

func WithRecovery Uses

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 Uses

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 Uses

func WithTracer(t *apm.Tracer) Option

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

type Router Uses

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 Uses

func New(o ...Option) *Router

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

Router.NotFound and Router.MethodNotAllowed will be set, and will report transactions with the name "<METHOD> unknown route".

func (*Router) DELETE Uses

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

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

func (*Router) GET Uses

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

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

func (*Router) HEAD Uses

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

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

func (*Router) Handle Uses

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

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

func (*Router) Handler Uses

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

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

func (*Router) HandlerFunc Uses

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

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

func (*Router) OPTIONS Uses

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

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

func (*Router) PATCH Uses

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

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

func (*Router) POST Uses

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

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

func (*Router) PUT Uses

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

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

Package apmhttprouter imports 5 packages (graph). Updated 2019-07-02. Refresh now. Tools for package owners.