apmatreugo

package module
v0.0.0-...-acd5039 Latest Latest
Warning

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

Go to latest
Published: May 6, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

README

apm

Test status Go Report Card GoDev

Elastic APM Middleware

Install

go get github.com/atreugo/apm

Contributing

Feel free to contribute... 😉

Documentation

Overview

Package apmatreugo provides a factory to create the tracing middleware and panic view for atreugo server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory struct {
	// contains filtered or unexported fields
}

Factory is a factory to create the tracing middleware and panic view.

func New

func New(options ...Option) *Factory

New returns a factory instance.

func (*Factory) Middleware

func (f *Factory) Middleware() atreugo.Middleware

Middleware returns a middleware.

func (*Factory) PanicView

func (f *Factory) PanicView() atreugo.PanicView

PanicView returns a panic view.

type Option

type Option func(*Factory)

Option sets options for tracing requests.

func WithPanicPropagation

func WithPanicPropagation() Option

WithPanicPropagation returns a Option which enable panic propagation. Any panic will be recovered and recorded as an error in a transaction, then panic will be caused again.

func WithRecovery

func WithRecovery(r RecoveryFunc) Option

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

func WithServerRequestIgnorer

func WithServerRequestIgnorer(fn RequestIgnorerFunc) Option

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

func WithServerRequestName

func WithServerRequestName(fn RequestNameFunc) Option

WithServerRequestName returns a Option which sets fn as the function to use to obtain the transaction name for the given server request.

func WithTracer

func WithTracer(t *apm.Tracer) Option

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

type RecoveryFunc

type RecoveryFunc func(ctx *atreugo.RequestCtx, tx *apm.Transaction, bc *apm.BodyCapturer, recovered interface{})

RecoveryFunc is the type of a function for use in WithRecovery.

type RequestIgnorerFunc

type RequestIgnorerFunc func(*atreugo.RequestCtx) bool

RequestIgnorerFunc is the type of a function for use in WithServerRequestIgnorer.

type RequestNameFunc

type RequestNameFunc func(*atreugo.RequestCtx) string

RequestNameFunc is the type of a function for use in WithServerRequestName.

Jump to

Keyboard shortcuts

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