Documentation ¶
Overview ¶
Package splunkhttprouter provides OpenTelemetry instrumentation for the github.com/julienschmidt/httprouter module.
Example ¶
package main import ( "fmt" "net/http" "github.com/julienschmidt/httprouter" "github.com/signalfx/splunk-otel-go/instrumentation/github.com/julienschmidt/httprouter/splunkhttprouter" ) func Index(w http.ResponseWriter, _ *http.Request, _ httprouter.Params) { fmt.Fprint(w, "Welcome!\n") } func Hello(w http.ResponseWriter, _ *http.Request, ps httprouter.Params) { fmt.Fprintf(w, "hello, %s!\n", ps.ByName("name")) } func main() { router := splunkhttprouter.New() router.GET("/", Index) router.GET("/hello/:name", Hello) if err := http.ListenAndServe(":8080", router); err != nil { panic(err) } }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
Click to show internal directories.
Click to hide internal directories.