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 SetErrorWithEvent(r *http.Request, format string, args ...interface{})
- func StartSpan(r *http.Request, operationName string, spanKind ext.SpanKindEnum, ...) (opentracing.Span, *http.Request, func())
- func WithTracing(ctx context.Context, tracing *Tracing) context.Context
- type Backend
- type HTTPHeadersCarrier
- 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) StartSpan(operationName string, opts ...opentracing.StartSpanOption) opentracing.Span
- func (t *Tracing) StartSpanf(r *http.Request, spanKind ext.SpanKindEnum, opPrefix string, opParts []string, ...) (opentracing.Span, *http.Request, func())
Constants ¶
const OperationNameMaxLengthNumber = 10
OperationNameMaxLengthNumber defines the number of static characters in a Span Trace name: 8 chars for hash + 2 chars for '_'.
const ( // SpanKindNoneEnum Span kind enum none. SpanKindNoneEnum ext.SpanKindEnum = "none" )
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 SetErrorWithEvent ¶
SetErrorWithEvent flags the span associated with this request as in error and log an event.
Types ¶
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 Tracing ¶
type Tracing struct { 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"` // contains filtered or unexported fields }
Tracing middleware.
func FromContext ¶
FromContext Gets Tracing from context.
func NewTracing ¶
NewTracing Creates a Tracing.