Documentation

Overview

    Package httprouter provides functions to trace the julienschmidt/httprouter package (https://github.com/julienschmidt/httprouter).

    Example
    Output:
    
    
    Example (WithServiceName)
    Output:
    
    
    Example (WithSpanOpts)
    Output:
    
    

    Index

    Examples

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    This section is empty.

    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.