How do I add a Subrouter to muxtrace.Router()?

206 views Asked by At

I currently have a function in Go that creates a subrouter if a mountpoint is passed when creating a new server. I want to set up tracing using muxtrace.

import {
  muxtrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/gorilla/mux"
  ...
}

...

router := muxtrace.NewRouter()

if mountpoint != "" {
    router = router.PathPrefix(mountpoint).Subrouter()
}

router = router.PathPrefix(mountpoint).Subrouter() returns an error:

cannot use router.PathPrefix(mountpoint).Subrouter() (value of type *mux.Router) as *mux.Router value in assignment

It doesn't look like there is a Subrouter for the *mux.Router type used in the tracing package. So how would I trace the sub route?

0

There are 0 answers