Documentation ¶
Overview ¶
Package tracing is a generated protocol buffer package.
It is generated from these files:
cockroach/pkg/util/tracing/span_context_carrier.proto
It has these top-level messages:
SpanContextCarrier
Index ¶
- Constants
- Variables
- func AnnotateTrace()
- func ChildSpan(ctx context.Context, opName string) (context.Context, opentracing.Span)
- 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, name string) (context.Context, func())
- func FinishSpan(span opentracing.Span)
- func ForkCtxSpan(ctx context.Context, opName string) (context.Context, opentracing.Span)
- func FormatRawSpans(spans []basictracer.RawSpan) string
- func IngestRemoteSpans(ctx context.Context, remoteSpans [][]byte) error
- func NewTracer() opentracing.Tracer
- type CallbackRecorder
- type RecordedTrace
- func JoinRemoteTrace(ctx context.Context, tr opentracing.Tracer, carrier *SpanContextCarrier, ...) (context.Context, *RecordedTrace, error)
- func NewRecordingTracer() (opentracing.Tracer, *RecordedTrace)
- func NewTracerAndSpanFor7881(ctx context.Context) (context.Context, *RecordedTrace, error)
- func StartSnowballTrace(ctx context.Context, opName string) (context.Context, *RecordedTrace, error)
- type SpanContextCarrier
- func (*SpanContextCarrier) Descriptor() ([]byte, []int)
- func (sp *SpanContextCarrier) GetBaggage(fn func(key, value string))
- func (m *SpanContextCarrier) Marshal() (dAtA []byte, err error)
- func (m *SpanContextCarrier) MarshalTo(dAtA []byte) (int, error)
- func (*SpanContextCarrier) ProtoMessage()
- func (m *SpanContextCarrier) Reset()
- func (sp *SpanContextCarrier) SetBaggageItem(key, value string)
- func (sp *SpanContextCarrier) SetState(traceID, spanID uint64, sampled bool)
- func (m *SpanContextCarrier) Size() (n int)
- func (sp *SpanContextCarrier) State() (traceID, spanID uint64, sampled bool)
- func (m *SpanContextCarrier) String() string
- func (m *SpanContextCarrier) 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)deprecated
- func (ts *TeeSpan) LogEvent(event string)deprecated
- func (ts *TeeSpan) LogEventWithPayload(event string, payload interface{})deprecated
- func (ts *TeeSpan) LogFields(fields ...otlog.Field)
- func (ts *TeeSpan) LogKV(alternatingKeyValues ...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) CreateSpanFrom(spans ...spanWithOpt) *TeeSpan
- 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 ( ErrInvalidLengthSpanContextCarrier = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowSpanContextCarrier = 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 ChildSpan ¶
ChildSpan opens a span as a child of the current span in the context (if there is one).
Returns the new context and the new span (if any). The span should be closed via FinishSpan.
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 ¶
func EnsureContext( ctx context.Context, tracer opentracing.Tracer, name string, ) (context.Context, func())
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 FinishSpan ¶
func FinishSpan(span opentracing.Span)
FinishSpan closes the given span (if not nil). It is a convenience wrapper for span.Finish() which tolerates nil spans.
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 the new span (if any). The span should be closed via FinishSpan.
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 IngestRemoteSpans ¶
IngestRemoteSpans takes a bunch of encoded spans and passes them to a Recorder in the Context.
func NewTracer ¶
func NewTracer() opentracing.Tracer
NewTracer creates a Tracer which records to the net/trace endpoint.
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 RecordedTrace ¶
RecordedTrace is associated with a span and records the respective span and all child spans. It is created, together with a request-specific tracer, by NewRecordingTracer(). The addSpan() method is used as a tracer recorder.
func JoinRemoteTrace ¶
func JoinRemoteTrace( ctx context.Context, tr opentracing.Tracer, carrier *SpanContextCarrier, opName string, ) (context.Context, *RecordedTrace, error)
JoinRemoteTrace takes a Context and returns a derived one with a Span that's a child of a remote span carried over by carrier. The caller is responsible for Finish()ing this span. If the trace is a "snowball trace", then the span will be created by a per-request TeeTracer, which both records the trace and also pipes everything to tr.
tr must be a tracer able to extract the SpanContext from carrier.
It returns the derived context and a RecordedTrace. This will be nil if the remote trace is not a "snowball trace"; otherwise, it will be a handle on the recording of the trace rooted by the span created here. When this span is closed, the caller should serialize the RecordedTrace and send it over the wire to the remote party.
func NewRecordingTracer ¶
func NewRecordingTracer() (opentracing.Tracer, *RecordedTrace)
NewRecordingTracer creates a request-specific tracer that will record its trace.
func NewTracerAndSpanFor7881 ¶
NewTracerAndSpanFor7881 creates a new tracer and a root span. The tracer is to be used for tracking down #7881. Note that this is not a "snowball" trace; otherwise this function mirrors StartSnowballTrace().
func StartSnowballTrace ¶
func StartSnowballTrace( ctx context.Context, opName string, ) (context.Context, *RecordedTrace, error)
StartSnowballTrace takes in a context and returns a derived one with a "snowball span" in it. The caller takes ownership of this span from the returned context and is in charge of Finish()ing it. A recorder that will receive both local and remote child spans is also returned.
If there's already a span in the passed-in context, then a per-request TeeTracer will be used for creating this new snowball span; the existing span thus continues to be in effect. Note that ownership of the existing span is not transferred in any way - it will not be Finish()ed when the TeeSpan is Finish()ed.
func (*RecordedTrace) AddDummySpan ¶
func (tr *RecordedTrace) AddDummySpan(rs basictracer.RawSpan)
AddDummySpan is an external version of addSpan. TODO(andrei): get rid of this when explainTraceNode goes away.
func (*RecordedTrace) ClearSpans ¶
func (tr *RecordedTrace) ClearSpans()
ClearSpans clears the spans accumulated so far. TODO(andrei): remove this once the we get rid of explainTraceNode and its weird use case for this.
func (*RecordedTrace) Done ¶
func (tr *RecordedTrace) Done()
Done marks the recorder such that future spans are rejected.
func (*RecordedTrace) GetSpans ¶
func (tr *RecordedTrace) GetSpans() []basictracer.RawSpan
GetSpans returns all accumulated spans.
type SpanContextCarrier ¶
type SpanContextCarrier 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 SpanContextCarrier message holds metadata of a (potentially ongoing) span of a distributed trace as per the OpenTracing specification. See http://opentracing.io/documentation/pages/spec for details.
func (*SpanContextCarrier) Descriptor ¶
func (*SpanContextCarrier) Descriptor() ([]byte, []int)
func (*SpanContextCarrier) GetBaggage ¶
func (sp *SpanContextCarrier) GetBaggage(fn func(key, value string))
GetBaggage implements basictracer.DelegatingCarrier.
func (*SpanContextCarrier) Marshal ¶
func (m *SpanContextCarrier) Marshal() (dAtA []byte, err error)
func (*SpanContextCarrier) MarshalTo ¶
func (m *SpanContextCarrier) MarshalTo(dAtA []byte) (int, error)
func (*SpanContextCarrier) ProtoMessage ¶
func (*SpanContextCarrier) ProtoMessage()
func (*SpanContextCarrier) Reset ¶
func (m *SpanContextCarrier) Reset()
func (*SpanContextCarrier) SetBaggageItem ¶
func (sp *SpanContextCarrier) SetBaggageItem(key, value string)
SetBaggageItem implements basictracer.DelegatingCarrier.
func (*SpanContextCarrier) SetState ¶
func (sp *SpanContextCarrier) SetState(traceID, spanID uint64, sampled bool)
SetState implements basictracer.DelegatingCarrier.
func (*SpanContextCarrier) Size ¶
func (m *SpanContextCarrier) Size() (n int)
func (*SpanContextCarrier) State ¶
func (sp *SpanContextCarrier) State() (traceID, spanID uint64, sampled bool)
State implements basictracer.DelegatingCarrier.
func (*SpanContextCarrier) String ¶
func (m *SpanContextCarrier) String() string
func (*SpanContextCarrier) Unmarshal ¶
func (m *SpanContextCarrier) Unmarshal(dAtA []byte) error
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
deprecated
func (ts *TeeSpan) Log(data opentracing.LogData)
Log is part of the opentracing.Span interface.
Deprecated: use LogKV/LogFields.
func (*TeeSpan) LogEventWithPayload
deprecated
func (*TeeSpan) LogKV ¶
func (ts *TeeSpan) LogKV(alternatingKeyValues ...interface{})
LogKV 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 NewTeeTracer ¶
func NewTeeTracer(tracers ...opentracing.Tracer) *TeeTracer
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 (*TeeTracer) CreateSpanFrom ¶
CreateSpanFrom creates a TeeSpan that will contains the passed-in spans. Depending on span.owned, the TeeSpan takes ownership of some of the child spans.
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.