Documentation ¶
Overview ¶
Package tracing provides distributed tracing services to Trickster
Index ¶
- Variables
- func ContextWithSpan(ctx context.Context, span trace.Span) context.Context
- func HTTPToCode(status int) codes.Code
- func NewChildSpan(ctx context.Context, tr trace.Tracer, spanName string) (context.Context, trace.Span)
- func PrepareRequest(r *http.Request, tr trace.Tracer) (*http.Request, trace.Span)
- func SetTracer(impl TracerImplementation, ex TraceExporter, collectorURL string, ...) (trace.Tracer, func(), *recorderExporter, error)
- func SpanFromContext(ctx context.Context) trace.Span
- type TraceExporter
- type TracerImplementation
Constants ¶
This section is empty.
Variables ¶
var ( // TraceExporters is map of TraceExporters accessible by their string value TraceExporters = map[string]TraceExporter{ "noop": NoopExporter, "recorder": RecorderExporter, "stdout": StdoutExporter, "jaeger": JaegerExporter, } // TraceExporterStrings is the reverse map of TraceExporters TraceExporterStrings = map[TraceExporter]string{} )
var ( // TracerImplementations is map of TracerImplementations accessible by their string value TracerImplementations = map[string]TracerImplementation{ "opentelemetry": OpenTelemetryTracer, "opentracing": OpenTracingTracer, } // TracerImplementationStrings is the reverse map of TracerImplementations TracerImplementationStrings = map[TracerImplementation]string{} )
Functions ¶
func ContextWithSpan ¶
ContextWithSpan returns a context with the provided span attached
func HTTPToCode ¶
HTTPToCode translates an HTTP status code into a GRPC code
func NewChildSpan ¶
func NewChildSpan(ctx context.Context, tr trace.Tracer, spanName string) (context.Context, trace.Span)
NewChildSpan returns the context with a new Span situated as the child of the previous span
func PrepareRequest ¶
PrepareRequest extracts trace information from the headers of the incoming request. It returns a pointer to the incoming request with the request context updated to include all span and tracing info. It also returns a span with the name "Request" that is meant to be a parent span for all child spans of this request.
func SetTracer ¶
func SetTracer(impl TracerImplementation, ex TraceExporter, collectorURL string, sampleRate float64) (trace.Tracer, func(), *recorderExporter, error)
SetTracer sets up the requested tracer implementation
Types ¶
type TraceExporter ¶
type TraceExporter int
TraceExporter defines the implementation of Tracer Exporter to Use
const ( // NoopExporter indicates a Exporter Implementation wherein all methods are no-ops. // This should be used when tracing is not enabled or not sampled. NoopExporter TraceExporter = iota // RecorderExporter represents the Recorder Export Implementation RecorderExporter // StdoutExporter represents the Standard Output Exporter Implementation StdoutExporter // JaegerExporter represents the Jaeger Tracing Exporter Implementation JaegerExporter )
func (TraceExporter) String ¶
func (t TraceExporter) String() string
type TracerImplementation ¶
type TracerImplementation int
TracerImplementation defines the implementation of Tracer to Use
const ( // OpenTelemetryTracer is a tracer that accepts the Open Telemetry standard tracing format. OpenTelemetryTracer TracerImplementation = iota // OpenTracingTracer accepts and uses traces in the OpenTracing format OpenTracingTracer )
func (TracerImplementation) String ¶
func (t TracerImplementation) String() string
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package registration registers configured tracers for use with handlers
|
Package registration registers configured tracers for use with handlers |