tracing

package
v8.0.0-...-36f974d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractSpanAndTraceID

func ExtractSpanAndTraceID(r *http.Request) (traceID, spanID string)

ExtractSpanAndTraceID extracts span and trace IDs from an http request header.

func MuxServerMiddleware

func MuxServerMiddleware(serviceName string) func(http.Handler) http.Handler

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. Right now we only support logging IDs in the format that Datadog expects.

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(ctx context.Context) (sdktrace.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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL