Version: v0.3.5 Latest Latest

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

Go to latest
Published: Dec 19, 2018 License: MIT Imports: 7 Imported by: 0



Package middleware provides some usable transport middleware to deal with propagating Zipkin traces across service boundaries.



This section is empty.


This section is empty.


This section is empty.


type HandlerFunc

type HandlerFunc func(next http.Handler) http.Handler

HandlerFunc is a middleware function for incoming HTTP requests.

func FromHTTPRequest

func FromHTTPRequest(tracer opentracing.Tracer, operationName string,
) HandlerFunc

FromHTTPRequest returns a Middleware HandlerFunc that tries to join with an OpenTracing trace found in the HTTP request headers and starts a new Span called `operationName`. If no trace could be found in the HTTP request headers, the Span will be a trace root. The Span is incorporated in the HTTP Context object and can be retrieved with opentracing.SpanFromContext(ctx).

type RequestFunc

type RequestFunc func(req *http.Request) *http.Request

RequestFunc is a middleware function for outgoing HTTP requests.

func ToHTTPRequest

func ToHTTPRequest(tracer opentracing.Tracer) RequestFunc

ToHTTPRequest returns a RequestFunc that injects an OpenTracing Span found in context into the HTTP Headers. If no such Span can be found, the RequestFunc is a noop.

Source Files

Jump to

Keyboard shortcuts

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