Documentation ¶
Overview ¶
Package opentracing provides Go kit integration to the OpenTracing project. OpenTracing implements a general purpose interface that microservices can program against, and which adapts to all major distributed tracing systems.
Index ¶
- func ContextToGRPC(tracer opentracing.Tracer, logger log.Logger) func(ctx context.Context, md *metadata.MD) context.Context
- func ContextToHTTP(tracer opentracing.Tracer, logger log.Logger) kithttp.RequestFunc
- func GRPCToContext(tracer opentracing.Tracer, operationName string, logger log.Logger) func(ctx context.Context, md metadata.MD) context.Context
- func HTTPToContext(tracer opentracing.Tracer, operationName string, logger log.Logger) kithttp.RequestFunc
- func TraceClient(tracer opentracing.Tracer, operationName string) endpoint.Middleware
- func TraceServer(tracer opentracing.Tracer, operationName string) endpoint.Middleware
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextToGRPC ¶ added in v0.6.0
func ContextToGRPC(tracer opentracing.Tracer, logger log.Logger) func(ctx context.Context, md *metadata.MD) context.Context
ContextToGRPC returns a grpc RequestFunc that injects an OpenTracing Span found in `ctx` into the grpc Metadata. If no such Span can be found, the RequestFunc is a noop.
func ContextToHTTP ¶ added in v0.6.0
func ContextToHTTP(tracer opentracing.Tracer, logger log.Logger) kithttp.RequestFunc
ContextToHTTP returns an http RequestFunc that injects an OpenTracing Span found in `ctx` into the http headers. If no such Span can be found, the RequestFunc is a noop.
func GRPCToContext ¶ added in v0.6.0
func GRPCToContext(tracer opentracing.Tracer, operationName string, logger log.Logger) func(ctx context.Context, md metadata.MD) context.Context
GRPCToContext returns a grpc RequestFunc that tries to join with an OpenTracing trace found in `req` and starts a new Span called `operationName` accordingly. If no trace could be found in `req`, the Span will be a trace root. The Span is incorporated in the returned Context and can be retrieved with opentracing.SpanFromContext(ctx).
func HTTPToContext ¶ added in v0.6.0
func HTTPToContext(tracer opentracing.Tracer, operationName string, logger log.Logger) kithttp.RequestFunc
HTTPToContext returns an http RequestFunc that tries to join with an OpenTracing trace found in `req` and starts a new Span called `operationName` accordingly. If no trace could be found in `req`, the Span will be a trace root. The Span is incorporated in the returned Context and can be retrieved with opentracing.SpanFromContext(ctx).
func TraceClient ¶
func TraceClient(tracer opentracing.Tracer, operationName string) endpoint.Middleware
TraceClient returns a Middleware that wraps the `next` Endpoint in an OpenTracing Span called `operationName`.
func TraceServer ¶
func TraceServer(tracer opentracing.Tracer, operationName string) endpoint.Middleware
TraceServer returns a Middleware that wraps the `next` Endpoint in an OpenTracing Span called `operationName`.
If `ctx` already has a Span, it is re-used and the operation name is overwritten. If `ctx` does not yet have a Span, one is created here.
Types ¶
This section is empty.