Documentation ¶
Index ¶
- func ExtractSpanAndTraceID(r *http.Request) (traceID, spanID string)
- func MuxServerMiddleware(serviceName string) func(http.Handler) http.Handler
- func NewTransport(baseTransport http.RoundTripper, spanNameCtxValue interface{}) http.RoundTripper
- func SetupGlobalTraceProviderAndExporter() (sdkexporttrace.SpanExporter, *sdktrace.TracerProvider, error)
- func SetupGlobalTraceProviderAndExporterForTest() (*tracetest.InMemoryExporter, *sdktrace.TracerProvider, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractSpanAndTraceID ¶
ExtractSpanAndTraceID extracts span and trace IDs from an http request header.
func MuxServerMiddleware ¶
MuxServerMiddleware returns middleware that should be attached to a gorilla/mux server. It does two things: starts spans, and adds span/trace info to the request-specific logger.
func NewTransport ¶
func NewTransport(baseTransport http.RoundTripper, spanNameCtxValue interface{}) http.RoundTripper
NewTransport returns the transport to use in client requests. It takes in a transport to wrap, e.g. http.DefaultTransport, and the request context value to pull the span name out from. The exporter is pulled from the global one on each request, so tracing won't begin until that is initialized (e.g, in in server startup).
func SetupGlobalTraceProviderAndExporter ¶
func SetupGlobalTraceProviderAndExporter() (sdkexporttrace.SpanExporter, *sdktrace.TracerProvider, error)
SetupGlobalTraceProviderAndExporter sets up an exporter to export, as well as the opentelemetry global trace provider for trace generators to use. The exporter and provider are returned in order for the caller to defer shutdown.
func SetupGlobalTraceProviderAndExporterForTest ¶
func SetupGlobalTraceProviderAndExporterForTest() (*tracetest.InMemoryExporter, *sdktrace.TracerProvider, error)
SetupGlobalTraceProviderAndExporterForTest is meant to be used in unit testing, and mirrors the setup above for outside of unit testing. It returns an in-memory exporter for examining generated spans.
Types ¶
This section is empty.