Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Monitor ¶
func Monitor(opts ...MonitorOption) func(http.Handler) http.Handler
Monitor monitors HTTP requests. Each requests goes through this middleware which records basic information about it (latency, error, ...)
Types ¶
type MonitorOption ¶
type MonitorOption func(*monitorOptions)
MonitorOption applies option to the http monitor.
func MonitorWithHasRequestFailedFunc ¶
func MonitorWithHasRequestFailedFunc(fct func(r *http.Request) bool) MonitorOption
MonitorWithHasRequestFailedFunc sets the function call to check whenever the request failed as the provided one.
type OnPanicFunc ¶
type OnPanicFunc func(w http.ResponseWriter, r *http.Request, reason interface{}, stack []byte)
OnPanicFunc is the signature of the callback called each time the request panics.
type Tracer ¶
type Tracer struct {
// contains filtered or unexported fields
}
Tracer stores the configuration for the tracer.
func NewTracer ¶
func NewTracer(opts ...TracerOption) *Tracer
NewTracer creates a new tracer with the provided options.
type TracerOption ¶
type TracerOption func(o *Tracer)
TracerOption applies options to the tracer.
func TracerWithAlwaysSampler ¶
func TracerWithAlwaysSampler() TracerOption
TracerWithAlwaysSampler sets the sampler of the tracer.
func TracerWithCallback ¶
func TracerWithCallback(fcts ...func(r *http.Request, span *trace.Span)) TracerOption
TracerWithCallback sets function that will be called at the end of the request in the tracer.
func TracerWithNeverSampler ¶
func TracerWithNeverSampler() TracerOption
TracerWithNeverSampler sets the sampler of the tracer.
func TracerWithProbabilitySampler ¶
func TracerWithProbabilitySampler(fraction float64) TracerOption
TracerWithProbabilitySampler sets the sampler of the tracer.
func TracerWithSampler ¶
func TracerWithSampler(sampler trace.Sampler) TracerOption
TracerWithSampler sets the sampler of the tracer.