Documentation ¶
Overview ¶
Example ¶
package main import ( "net/http" httptrace "github.com/DataDog/dd-trace-go/contrib/net/http" ) func handler(w http.ResponseWriter, r *http.Request) { w.Write([]byte("Hello World!\n")) } func main() { mux := httptrace.NewServeMux("web-service", nil) mux.HandleFunc("/", handler) http.ListenAndServe(":8080", mux) }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ResponseWriter ¶
type ResponseWriter struct { http.ResponseWriter // contains filtered or unexported fields }
ResponseWriter is a small wrapper around an http response writer that will intercept and store the status of a request. It implements the ResponseWriter interface.
func NewResponseWriter ¶
func NewResponseWriter(w http.ResponseWriter, span *tracer.Span) *ResponseWriter
New ResponseWriter allocateds and returns a new ResponseWriter.
func (*ResponseWriter) Write ¶
func (w *ResponseWriter) Write(b []byte) (int, error)
Write writes the data to the connection as part of an HTTP reply. We explicitely call WriteHeader with the 200 status code in order to get it reported into the span.
func (*ResponseWriter) WriteHeader ¶
func (w *ResponseWriter) WriteHeader(status int)
WriteHeader sends an HTTP response header with status code. It also sets the status code to the span.
type ServeMux ¶
ServeMux is an HTTP request multiplexer that traces all the incoming requests.
func NewServeMux ¶
NewServeMux allocates and returns a new ServeMux.
Click to show internal directories.
Click to hide internal directories.