DDRouter

package
v0.0.0-...-6ee9a09 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnalyticsRate

func AnalyticsRate() float64

AnalyticsRate returns the sampling rate at which events should be marked. It uses synchronizing mechanisms, meaning that for optimal performance it's best to read it once and store it.

func SetAnalyticsRate

func SetAnalyticsRate(rate float64)

SetAnalyticsRate sets the given event sampling rate globally.

func TraceAndServe

func TraceAndServe(h http.Handler, w http.ResponseWriter, r *http.Request, service, resource string, spanopts ...ddtrace.StartSpanOption)

TraceAndServe will apply tracing to the given http.Handler using the passed tracer under the given service and resource.

Types

type Router

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

Router is a traced version of httprouter.Router.

func New

func New(opts ...RouterOption) *Router

New returns a new router augmented with tracing.

func (*Router) ServeHTTP

func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP implements http.Handler.

type RouterOption

type RouterOption func(*routerConfig)

RouterOption represents an option that can be passed to New.

func WithAnalytics

func WithAnalytics(on bool) RouterOption

WithAnalytics enables Trace Analytics for all started spans.

func WithAnalyticsRate

func WithAnalyticsRate(rate float64) RouterOption

WithAnalyticsRate sets the sampling rate for Trace Analytics events correlated to started spans.

func WithServiceName

func WithServiceName(name string) RouterOption

WithServiceName sets the given service name for the returned router.

func WithSpanOptions

func WithSpanOptions(opts ...ddtrace.StartSpanOption) RouterOption

WithSpanOptions applies the given set of options to the span started by the router.

Jump to

Keyboard shortcuts

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