Documentation ¶
Overview ¶
Package gct contains initialization for Google Cloud Trace opentracing.Tracer.
Index ¶
- Constants
- func ContextWithTracer(ctx context.Context, tracer opentracing.Tracer) context.Context
- func HTTPMiddleware(tracer opentracing.Tracer, name string, logger log.Logger, next http.Handler) http.HandlerFunc
- func HTTPTripperware(logger log.Logger, next http.RoundTripper) http.RoundTripper
- func NewOptionalGCloudTracer(ctx context.Context, logger log.Logger, gcloudTraceProjectID string, ...) (opentracing.Tracer, func() error)
- func StartSpan(ctx context.Context, operationName string, opts ...opentracing.StartSpanOption) (opentracing.Span, context.Context)
- func StreamClientInterceptor(tracer opentracing.Tracer) grpc.StreamClientInterceptor
- func StreamServerInterceptor(tracer opentracing.Tracer) grpc.StreamServerInterceptor
- func UnaryClientInterceptor(tracer opentracing.Tracer) grpc.UnaryClientInterceptor
- func UnaryServerInterceptor(tracer opentracing.Tracer) grpc.UnaryServerInterceptor
Constants ¶
const ForceTracingBaggageKey = "X-Thanos-Force-Tracing"
Variables ¶
This section is empty.
Functions ¶
func ContextWithTracer ¶
ContextWithTracer returns a new `context.Context` that holds a reference to given opentracing.Tracer.
func HTTPMiddleware ¶
func HTTPMiddleware(tracer opentracing.Tracer, name string, logger log.Logger, next http.Handler) http.HandlerFunc
HTTPMiddleware returns HTTP handler that injects given tracer and starts new server span. If any client span is fetched wire we include that as our parent.
func HTTPTripperware ¶
func HTTPTripperware(logger log.Logger, next http.RoundTripper) http.RoundTripper
HTTPTripperware returns HTTP tripper that assumes given span in context as client child span and injects it into the wire. NOTE: It assumes tracer is given in request context. Also, it is caller responsibility to finish span.
func NewOptionalGCloudTracer ¶
func NewOptionalGCloudTracer(ctx context.Context, logger log.Logger, gcloudTraceProjectID string, sampleFactor uint64, debugName string) (opentracing.Tracer, func() error)
NewOptionalGCloudTracer returns GoogleCloudTracer Tracer. In case of error it log warning and returns noop tracer.
func StartSpan ¶
func StartSpan(ctx context.Context, operationName string, opts ...opentracing.StartSpanOption) (opentracing.Span, context.Context)
StartSpan starts and returns span with `operationName` using any Span found within given context. It uses traces propagated in context.
func StreamClientInterceptor ¶
func StreamClientInterceptor(tracer opentracing.Tracer) grpc.StreamClientInterceptor
StreamClientInterceptor returns a new streaming client interceptor for OpenTracing.
func StreamServerInterceptor ¶
func StreamServerInterceptor(tracer opentracing.Tracer) grpc.StreamServerInterceptor
StreamServerInterceptor returns a new streaming server interceptor for OpenTracing and injects given tracer.
func UnaryClientInterceptor ¶
func UnaryClientInterceptor(tracer opentracing.Tracer) grpc.UnaryClientInterceptor
UnaryClientInterceptor returns a new unary client interceptor for OpenTracing.
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(tracer opentracing.Tracer) grpc.UnaryServerInterceptor
UnaryServerInterceptor returns a new unary server interceptor for OpenTracing and injects given tracer.
Types ¶
This section is empty.