Documentation ¶
Index ¶
- type MockSpan
- func (ms *MockSpan) AddEvent(ctx context.Context, msg string, attrs ...core.KeyValue)
- func (ms *MockSpan) AddEventWithTimestamp(ctx context.Context, timestamp time.Time, msg string, attrs ...core.KeyValue)
- func (ms *MockSpan) AddLink(link apitrace.Link)
- func (ms *MockSpan) End(options ...apitrace.EndOption)
- func (ms *MockSpan) IsRecording() bool
- func (ms *MockSpan) Link(sc core.SpanContext, attrs ...core.KeyValue)
- func (ms *MockSpan) SetAttribute(attribute core.KeyValue)
- func (ms *MockSpan) SetAttributes(attributes ...core.KeyValue)
- func (ms *MockSpan) SetError(v bool)
- func (ms *MockSpan) SetName(name string)
- func (ms *MockSpan) SetStatus(status codes.Code)
- func (ms *MockSpan) SpanContext() core.SpanContext
- func (ms *MockSpan) Tracer() apitrace.Tracer
- type MockTracer
- func (mt *MockTracer) Start(ctx context.Context, name string, o ...apitrace.SpanOption) (context.Context, apitrace.Span)
- func (mt *MockTracer) WithComponent(name string) apitrace.Tracer
- func (mt *MockTracer) WithResources(attributes ...core.KeyValue) apitrace.Tracer
- func (mt *MockTracer) WithService(name string) apitrace.Tracer
- func (mt *MockTracer) WithSpan(ctx context.Context, name string, body func(context.Context) error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockSpan ¶
type MockSpan struct {
// contains filtered or unexported fields
}
MockSpan is a mock span used in association with MockTracer for testing purpose only.
func (*MockSpan) AddEventWithTimestamp ¶
func (ms *MockSpan) AddEventWithTimestamp(ctx context.Context, timestamp time.Time, msg string, attrs ...core.KeyValue)
AddEvent does nothing.
func (*MockSpan) IsRecording ¶
IsRecording always returns false for MockSpan.
func (*MockSpan) Link ¶
func (ms *MockSpan) Link(sc core.SpanContext, attrs ...core.KeyValue)
Link does nothing.
func (*MockSpan) SetAttribute ¶
SetAttribute does nothing.
func (*MockSpan) SetAttributes ¶
SetAttributes does nothing.
func (*MockSpan) SpanContext ¶
func (ms *MockSpan) SpanContext() core.SpanContext
SpanContext returns associated core.SpanContext. If the receiver is nil it returns an empty core.SpanContext
type MockTracer ¶
type MockTracer struct { // Sampled specifies if the new span should be sampled or not. Sampled bool // StartSpanID is used to initialize spanId. It is incremented by one // every time a new span is created. StartSpanID *uint64 }
MockTracer is a simple tracer used for testing purpose only. It only supports ChildOf option. SpanId is atomically increased every time a new span is created.
func (*MockTracer) Start ¶
func (mt *MockTracer) Start(ctx context.Context, name string, o ...apitrace.SpanOption) (context.Context, apitrace.Span)
Start starts a MockSpan. It creates a new Span based on Relation SpanContext option. TracdID is used from Relation Span Context and SpanID is assigned. If Relation SpanContext option is not specified then random TraceID is used. No other options are supported.
func (*MockTracer) WithComponent ¶
func (mt *MockTracer) WithComponent(name string) apitrace.Tracer
WithComponent does nothing and returns MockTracer implementation of Tracer.
func (*MockTracer) WithResources ¶
func (mt *MockTracer) WithResources(attributes ...core.KeyValue) apitrace.Tracer
WithResources does nothing and returns MockTracer implementation of Tracer.
func (*MockTracer) WithService ¶
func (mt *MockTracer) WithService(name string) apitrace.Tracer
WithService does nothing and returns MockTracer implementation of Tracer.