tracing

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package tracing provides distributed tracing services to Trickster

Index

Constants

This section is empty.

Variables

View Source
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{}
)
View Source
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

func ContextWithSpan(ctx context.Context, span trace.Span) context.Context

ContextWithSpan returns a context with the provided span attached

func HTTPToCode

func HTTPToCode(status int) codes.Code

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

func PrepareRequest(r *http.Request, tr trace.Tracer) (*http.Request, trace.Span)

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

func SpanFromContext

func SpanFromContext(ctx context.Context) trace.Span

SpanFromContext returns the current span from the provided context

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

Directories

Path Synopsis
Package registration registers configured tracers for use with handlers
Package registration registers configured tracers for use with handlers

Jump to

Keyboard shortcuts

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