trace

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2019 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, msg string, attrs ...core.KeyValue)

AddEvent does nothing.

func (*MockSpan) AddEventWithTimestamp

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

AddEvent does nothing.

func (ms *MockSpan) AddLink(link apitrace.Link)

AddLink 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 (ms *MockSpan) Link(sc core.SpanContext, attrs ...core.KeyValue)

Link does nothing.

func (*MockSpan) SetAttribute

func (ms *MockSpan) SetAttribute(attribute core.KeyValue)

SetAttribute does nothing.

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 {
	// 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

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.

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