trace

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

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) AddEvent

func (ms *MockSpan) AddEvent(ctx context.Context, name string, attrs ...core.KeyValue)

AddEvent does nothing.

func (*MockSpan) AddEventWithTimestamp

func (ms *MockSpan) AddEventWithTimestamp(ctx context.Context, timestamp time.Time, name string, attrs ...core.KeyValue)

AddEvent does nothing.

func (*MockSpan) End

func (ms *MockSpan) End(options ...apitrace.EndOption)

End does nothing.

func (*MockSpan) IsRecording

func (ms *MockSpan) IsRecording() bool

IsRecording always returns false for MockSpan.

func (*MockSpan) SetAttributes

func (ms *MockSpan) SetAttributes(attributes ...core.KeyValue)

SetAttributes does nothing.

func (*MockSpan) SetError

func (ms *MockSpan) SetError(v bool)

SetError does nothing.

func (*MockSpan) SetName

func (ms *MockSpan) SetName(name string)

SetName does nothing.

func (*MockSpan) SetStatus

func (ms *MockSpan) SetStatus(status codes.Code)

SetStatus 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

func (*MockSpan) Tracer

func (ms *MockSpan) Tracer() apitrace.Tracer

Tracer returns MockTracer implementation of Tracer.

type MockTracer

type MockTracer struct {
	// StartSpanID is used to initialize spanId. It is incremented by one
	// every time a new span is created.
	//
	// StartSpanID has to be aligned for 64-bit atomic operations.
	StartSpanID *uint64

	// Sampled specifies if the new span should be sampled or not.
	Sampled bool
}

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

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) WithSpan

func (mt *MockTracer) WithSpan(ctx context.Context, name string, body func(context.Context) error) error

WithSpan does nothing except executing the body.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL