Documentation ¶
Overview ¶
Package tracing is a generated protocol buffer package.
It is generated from these files:
cockroach/util/tracing/span.proto
It has these top-level messages:
Span
Index ¶
- Constants
- Variables
- func AnnotateTrace()
- func DecodeRawSpan(enc []byte, dest *basictracer.RawSpan) error
- func Disable() func()
- func EncodeRawSpan(rawSpan *basictracer.RawSpan, dest []byte) ([]byte, error)
- func EnsureContext(ctx context.Context, tracer opentracing.Tracer) (context.Context, func())
- func ForkCtxSpan(ctx context.Context, opName string) (context.Context, func())
- func FormatRawSpans(spans []basictracer.RawSpan) string
- func JoinOrNew(tr opentracing.Tracer, carrier *Span, opName string) (opentracing.Span, error)
- func JoinOrNewSnowball(opName string, carrier *Span, callback func(sp basictracer.RawSpan)) (opentracing.Span, error)
- func NewTeeTracer(tracers ...opentracing.Tracer) opentracing.Tracer
- func NewTracer() opentracing.Tracer
- func NewTracerAndSpanFor7881(callback func(sp basictracer.RawSpan)) (opentracing.Span, opentracing.Tracer, error)
- func TracerFromCtx(ctx context.Context) opentracing.Tracer
- func WithTracer(ctx context.Context, tracer opentracing.Tracer) context.Context
- type CallbackRecorder
- type Span
- func (*Span) Descriptor() ([]byte, []int)
- func (sp *Span) GetBaggage(fn func(key, value string))
- func (m *Span) Marshal() (data []byte, err error)
- func (m *Span) MarshalTo(data []byte) (int, error)
- func (*Span) ProtoMessage()
- func (m *Span) Reset()
- func (sp *Span) SetBaggageItem(key, value string)
- func (sp *Span) SetState(traceID, spanID uint64, sampled bool)
- func (m *Span) Size() (n int)
- func (sp *Span) State() (traceID, spanID uint64, sampled bool)
- func (m *Span) String() string
- func (m *Span) Unmarshal(data []byte) error
- type TeeSpan
- func (ts *TeeSpan) BaggageItem(restrictedKey string) string
- func (ts *TeeSpan) Context() opentracing.SpanContext
- func (ts *TeeSpan) Finish()
- func (ts *TeeSpan) FinishWithOptions(opts opentracing.FinishOptions)
- func (ts *TeeSpan) Log(data opentracing.LogData)
- func (ts *TeeSpan) LogEvent(event string)
- func (ts *TeeSpan) LogEventWithPayload(event string, payload interface{})
- func (ts *TeeSpan) SetBaggageItem(restrictedKey, value string) opentracing.Span
- func (ts *TeeSpan) SetOperationName(operationName string) opentracing.Span
- func (ts *TeeSpan) SetTag(key string, value interface{}) opentracing.Span
- func (ts *TeeSpan) Tracer() opentracing.Tracer
- type TeeSpanContext
- type TeeTracer
- func (t *TeeTracer) Extract(format interface{}, carrier interface{}) (opentracing.SpanContext, error)
- func (t *TeeTracer) Inject(sc opentracing.SpanContext, format interface{}, carrier interface{}) error
- func (t *TeeTracer) StartSpan(operationName string, opts ...opentracing.StartSpanOption) opentracing.Span
Constants ¶
const Snowball = "sb"
Snowball is set as Baggage on traces which are used for snowball tracing.
Variables ¶
var ( ErrInvalidLengthSpan = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowSpan = fmt.Errorf("proto: integer overflow") )
Functions ¶
func AnnotateTrace ¶
func AnnotateTrace()
AnnotateTrace adds an annotation to the golang executation tracer by calling a no-op cgo function.
func DecodeRawSpan ¶
func DecodeRawSpan(enc []byte, dest *basictracer.RawSpan) error
DecodeRawSpan unmarshals into the given RawSpan.
func Disable ¶
func Disable() func()
Disable is for benchmarking use and causes all future tracers to deal in no-ops. Calling the returned closure undoes this effect. There is no synchronization, so no moving parts are allowed while Disable and the closure are called.
func EncodeRawSpan ¶
func EncodeRawSpan(rawSpan *basictracer.RawSpan, dest []byte) ([]byte, error)
EncodeRawSpan encodes a raw span into bytes, using the given dest slice as a buffer.
func EnsureContext ¶
EnsureContext checks whether the given context.Context contains a Span. If not, it creates one using the provided Tracer and wraps it in the returned Span. The returned closure must be called after the request has been fully processed.
func ForkCtxSpan ¶
ForkCtxSpan checks if ctx has a Span open; if it does, it creates a new Span that follows from the original Span. This allows the resulting context to be used in an async task that might outlive the original operation.
Returns the new context and a function that closes the span.
func FormatRawSpans ¶
func FormatRawSpans(spans []basictracer.RawSpan) string
FormatRawSpans formats the given spans for human consumption, showing the relationship using nesting and times as both relative to the previous event and cumulative.
func JoinOrNew ¶
func JoinOrNew(tr opentracing.Tracer, carrier *Span, opName string) (opentracing.Span, error)
JoinOrNew creates a new Span joined to the provided DelegatingCarrier or creates Span from the given tracer.
func JoinOrNewSnowball ¶
func JoinOrNewSnowball(opName string, carrier *Span, callback func(sp basictracer.RawSpan)) (opentracing.Span, error)
JoinOrNewSnowball returns a Span which records directly via the specified callback. If the given DelegatingCarrier is nil, a new Span is created. otherwise, the created Span is a child. TODO(andrei): JoinOrNewSnowball creates a new tracer, which is not kosher. Also this can't use the lightstep tracer.
func NewTeeTracer ¶
func NewTeeTracer(tracers ...opentracing.Tracer) opentracing.Tracer
NewTeeTracer creates a Tracer that sends events to multiple Tracers.
Note that only the span from the first tracer is used for serialization purposes (Inject/Extract).
func NewTracer ¶
func NewTracer() opentracing.Tracer
NewTracer creates a Tracer which records to the net/trace endpoint.
func NewTracerAndSpanFor7881 ¶
func NewTracerAndSpanFor7881( callback func(sp basictracer.RawSpan), ) (opentracing.Span, opentracing.Tracer, error)
NewTracerAndSpanFor7881 creates a new tracer and a root span. The tracer is to be used for tracking down #7881; it runs a callback for each finished span (and the callback used accumulates the spans in a SQL txn).
func TracerFromCtx ¶
func TracerFromCtx(ctx context.Context) opentracing.Tracer
TracerFromCtx returns the tracer set on the context (or a parent context) via WithTracer.
func WithTracer ¶
WithTracer returns a context derived from the given context, for which TracerFromCtx returns the given tracer.
Types ¶
type CallbackRecorder ¶
type CallbackRecorder func(sp basictracer.RawSpan)
A CallbackRecorder immediately invokes itself on received trace spans.
func (CallbackRecorder) RecordSpan ¶
func (cr CallbackRecorder) RecordSpan(sp basictracer.RawSpan)
RecordSpan implements basictracer.SpanRecorder.
type Span ¶
type Span struct { TraceID uint64 `protobuf:"varint,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"` SpanID uint64 `protobuf:"varint,2,opt,name=span_id,json=spanId,proto3" json:"span_id,omitempty"` Sampled bool `protobuf:"varint,3,opt,name=sampled,proto3" json:"sampled,omitempty"` Baggage map[string]string `` /* 148-byte string literal not displayed */ }
A Span message holds metadata of a (potentially ongoing) span of a distributed trace as per the OpenTracing specification. See http://opentracing.io/spec/ for details.
func (*Span) Descriptor ¶
func (*Span) GetBaggage ¶
GetBaggage implements basictracer.DelegatingCarrier.
func (*Span) ProtoMessage ¶
func (*Span) ProtoMessage()
func (*Span) SetBaggageItem ¶
SetBaggageItem implements basictracer.DelegatingCarrier.
type TeeSpan ¶
type TeeSpan struct {
// contains filtered or unexported fields
}
TeeSpan is the opentracing.Span implementation used by the TeeTracer.
func (*TeeSpan) BaggageItem ¶
BaggageItem is part of the opentracing.Span interface.
func (*TeeSpan) Context ¶
func (ts *TeeSpan) Context() opentracing.SpanContext
Context is part of the opentracing.Span interface.
func (*TeeSpan) Finish ¶
func (ts *TeeSpan) Finish()
Finish is part of the opentracing.Span interface.
func (*TeeSpan) FinishWithOptions ¶
func (ts *TeeSpan) FinishWithOptions(opts opentracing.FinishOptions)
FinishWithOptions is part of the opentracing.Span interface.
func (*TeeSpan) Log ¶
func (ts *TeeSpan) Log(data opentracing.LogData)
Log is part of the opentracing.Span interface.
func (*TeeSpan) LogEventWithPayload ¶
LogEventWithPayload is part of the opentracing.Span interface.
func (*TeeSpan) SetBaggageItem ¶
func (ts *TeeSpan) SetBaggageItem(restrictedKey, value string) opentracing.Span
SetBaggageItem is part of the opentracing.Span interface.
func (*TeeSpan) SetOperationName ¶
func (ts *TeeSpan) SetOperationName(operationName string) opentracing.Span
SetOperationName is part of the opentracing.Span interface.
func (*TeeSpan) SetTag ¶
func (ts *TeeSpan) SetTag(key string, value interface{}) opentracing.Span
SetTag is part of the opentracing.Span interface.
func (*TeeSpan) Tracer ¶
func (ts *TeeSpan) Tracer() opentracing.Tracer
Tracer is part of the opentracing.Span interface.
type TeeSpanContext ¶
type TeeSpanContext struct {
// contains filtered or unexported fields
}
TeeSpanContext is an opentracing.SpanContext that keeps track of SpanContexts from multiple tracers.
func (TeeSpanContext) ForeachBaggageItem ¶
func (tsc TeeSpanContext) ForeachBaggageItem(handler func(k, v string) bool)
ForeachBaggageItem is part of the opentracing.SpanContext interface.
type TeeTracer ¶
type TeeTracer struct {
// contains filtered or unexported fields
}
TeeTracer is an opentracing.Tracer that sends events to multiple Tracers.
func (*TeeTracer) Extract ¶
func (t *TeeTracer) Extract( format interface{}, carrier interface{}, ) (opentracing.SpanContext, error)
Extract is part of the opentracing.Tracer interface.
func (*TeeTracer) Inject ¶
func (t *TeeTracer) Inject( sc opentracing.SpanContext, format interface{}, carrier interface{}, ) error
Inject is part of the opentracing.Tracer interface.
func (*TeeTracer) StartSpan ¶
func (t *TeeTracer) StartSpan( operationName string, opts ...opentracing.StartSpanOption, ) opentracing.Span
StartSpan is part of the opentracing.Tracer interface.