Documentation ¶
Overview ¶
Package web provides functions to trace the zenazn/goji/web package (https://github.com/zenazn/goji).
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Middleware ¶
Middleware returns a goji middleware function that will trace incoming requests. If goji's Router middleware is also installed, the tracer will be able to determine the original route name (e.g. "/user/:id"), and include it as part of the traces' resource names.
Example ¶
package main import ( "fmt" "net/http" "github.com/zenazn/goji" "github.com/zenazn/goji/web" webtrace "github.com/zleague/dd-trace-go/contrib/zenazn/goji.v1/web" ) func main() { // Using the Router middleware lets the tracer determine routes for // use in a trace's resource name ("GET /user/:id") // Otherwise the resource is only the method ("GET", "POST", etc.) goji.Use(goji.DefaultMux.Router) goji.Use(webtrace.Middleware()) goji.Get("/hello", func(c web.C, w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Why hello there!") }) goji.Serve() }
Output:
Types ¶
type Option ¶
type Option func(*config)
Option represents an option that can be passed to New.
func NoDebugStack ¶
func NoDebugStack() Option
NoDebugStack prevents stack traces from being attached to spans finishing with an error. This is useful in situations where errors are frequent and performance is critical.
func WithAnalytics ¶
WithAnalytics enables Trace Analytics for all started spans.
func WithAnalyticsRate ¶
WithAnalyticsRate sets the sampling rate for Trace Analytics events correlated to started spans.
func WithServiceName ¶
WithServiceName sets the given service name for the returned mux.
func WithSpanOptions ¶
func WithSpanOptions(opts ...ddtrace.StartSpanOption) Option
WithSpanOptions applies the given set of options to the span started by the mux.