package opentracing

import "github.com/go-kit/kit/tracing/opentracing"

Index

Functions

func FromGRPCRequest

func FromGRPCRequest(tracer opentracing.Tracer, operationName string, logger log.Logger) func(ctx context.Context, md *metadata.MD) context.Context

FromGRPCRequest 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).

The logger is used to report errors and may be nil.

func FromHTTPRequest

func FromHTTPRequest(tracer opentracing.Tracer, operationName string, logger log.Logger) kithttp.RequestFunc

FromHTTPRequest 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).

The logger is used to report errors and may be nil.

func ToGRPCRequest

func ToGRPCRequest(tracer opentracing.Tracer, logger log.Logger) func(ctx context.Context, md *metadata.MD) context.Context

ToGRPCRequest 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.

The logger is used to report errors and may be nil.

func ToHTTPRequest

func ToHTTPRequest(tracer opentracing.Tracer, logger log.Logger) kithttp.RequestFunc

ToHTTPRequest 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.

The logger is used to report errors and may be nil.

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.

Source Files

endpoint.go grpc.go http.go

Version
v0.1.0
Published
Jun 7, 2016
Platform
js/wasm
Imports
12 packages
Last checked
3 minutes ago

Tools for package owners.