Documentation ¶
Overview ¶
Package splunkhttp provides functions that add additional Splunk specific instrumentation by wrapping existing handlers.
Example ¶
package main import ( "fmt" "io" "net/http" "net/http/httptest" "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" "go.opentelemetry.io/otel/sdk/trace" "github.com/signalfx/splunk-otel-go/instrumentation/net/http/splunkhttp" ) func main() { var handler http.Handler = http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { io.WriteString(w, "Hello world") }) handler = splunkhttp.NewHandler(handler) handler = otelhttp.NewHandler(handler, "server", otelhttp.WithTracerProvider(trace.NewTracerProvider())) ts := httptest.NewServer(handler) defer ts.Close() resp, err := ts.Client().Get(ts.URL) if err != nil { fmt.Println(err) return } defer resp.Body.Close() fmt.Println("Access-Control-Expose-Headers:", resp.Header.Get("Access-Control-Expose-Headers")) fmt.Println("Server-Timing:", resp.Header.Get("Server-Timing")) }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.