Documentation ¶
Index ¶
- Constants
- func GetSpan(r *http.Request) opentracing.Span
- func InjectRequestHeaders(r *http.Request)
- func LogEventf(r *http.Request, format string, args ...interface{})
- func LogRequest(span opentracing.Span, r *http.Request)
- func LogResponseCode(span opentracing.Span, code int)
- func SetError(r *http.Request)
- func SetErrorAndDebugLog(r *http.Request, format string, args ...interface{})
- func SetErrorAndWarnLog(r *http.Request, format string, args ...interface{})
- func StartSpan(r *http.Request, operationName string, spanKinClient bool, ...) (opentracing.Span, *http.Request, func())
- type Backend
- type HTTPHandlerWrapper
- type HTTPHeadersCarrier
- type NegroniHandlerWrapper
- type Tracing
- func (t *Tracing) Close()
- func (t *Tracing) Extract(format interface{}, carrier interface{}) (opentracing.SpanContext, error)
- func (t *Tracing) Inject(sm opentracing.SpanContext, format interface{}, carrier interface{}) error
- func (t *Tracing) IsEnabled() bool
- func (t *Tracing) NewEntryPoint(name string) negroni.Handler
- func (t *Tracing) NewForwarderMiddleware(frontend, backend string) negroni.Handler
- func (t *Tracing) NewHTTPHandlerWrapper(name string, handler http.Handler, clientSpanKind bool) http.Handler
- func (t *Tracing) NewNegroniHandlerWrapper(name string, handler negroni.Handler, clientSpanKind bool) negroni.Handler
- func (t *Tracing) Setup()
- func (t *Tracing) StartSpan(operationName string, opts ...opentracing.StartSpanOption) opentracing.Span
Constants ¶
const EntryPointMaxLengthNumber = 21
EntryPointMaxLengthNumber defines the number of static characters in the Entrypoint Span Trace name : 11 chars for 'Entrypoint ' + 8 chars for hash + 2 chars for '_'.
const ForwardMaxLengthNumber = 18
ForwardMaxLengthNumber defines the number of static characters in the Forwarding Span Trace name : 8 chars for 'forward ' + 8 chars for hash + 2 chars for '_'.
const TraceNameHashLength = 8
TraceNameHashLength defines the number of characters to use from the head of the generated hash.
Variables ¶
This section is empty.
Functions ¶
func InjectRequestHeaders ¶
InjectRequestHeaders used to inject OpenTracing headers into the request
func LogRequest ¶
LogRequest used to create span tags from the request
func LogResponseCode ¶
func LogResponseCode(span opentracing.Span, code int)
LogResponseCode used to log response code in span
func SetErrorAndDebugLog ¶
SetErrorAndDebugLog flags the span associated with this request as in error and create a debug log.
func SetErrorAndWarnLog ¶
SetErrorAndWarnLog flags the span associated with this request as in error and create a debug log.
Types ¶
type HTTPHandlerWrapper ¶
type HTTPHandlerWrapper struct {
// contains filtered or unexported fields
}
HTTPHandlerWrapper is used to wrap http handler middleware
func (*HTTPHandlerWrapper) ServeHTTP ¶
func (t *HTTPHandlerWrapper) ServeHTTP(rw http.ResponseWriter, r *http.Request)
type HTTPHeadersCarrier ¶
HTTPHeadersCarrier custom implementation to fix duplicated headers It has been fixed in https://github.com/opentracing/opentracing-go/pull/191
func (HTTPHeadersCarrier) ForeachKey ¶
func (c HTTPHeadersCarrier) ForeachKey(handler func(key, val string) error) error
ForeachKey conforms to the TextMapReader interface.
func (HTTPHeadersCarrier) Set ¶
func (c HTTPHeadersCarrier) Set(key, val string)
Set conforms to the TextMapWriter interface.
type NegroniHandlerWrapper ¶
type NegroniHandlerWrapper struct {
// contains filtered or unexported fields
}
NegroniHandlerWrapper is used to wrap negroni handler middleware
func (*NegroniHandlerWrapper) ServeHTTP ¶
func (t *NegroniHandlerWrapper) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
type Tracing ¶
type Tracing struct { Backend string `description:"Selects the tracking backend ('jaeger','zipkin', 'datadog')." export:"true"` ServiceName string `description:"Set the name for this service" export:"true"` SpanNameLimit int `description:"Set the maximum character limit for Span names (default 0 = no limit)" export:"true"` Jaeger *jaeger.Config `description:"Settings for jaeger"` Zipkin *zipkin.Config `description:"Settings for zipkin"` DataDog *datadog.Config `description:"Settings for DataDog"` // contains filtered or unexported fields }
Tracing middleware
func (*Tracing) NewEntryPoint ¶
NewEntryPoint creates a new middleware that the incoming request
func (*Tracing) NewForwarderMiddleware ¶
NewForwarderMiddleware creates a new forwarder middleware that traces the outgoing request
func (*Tracing) NewHTTPHandlerWrapper ¶
func (t *Tracing) NewHTTPHandlerWrapper(name string, handler http.Handler, clientSpanKind bool) http.Handler
NewHTTPHandlerWrapper return a http.Handler struct