trace

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

func (*Provider) Tracer

func (p *Provider) Tracer(name string, _ ...oteltrace.TracerOption) oteltrace.Tracer

type Span

type Span struct {
	Name         string
	Attributes   map[otelkv.Key]otelvalue.Value
	Kind         oteltrace.SpanKind
	Status       codes.Code
	ParentSpanID oteltrace.SpanID
	// contains filtered or unexported fields
}

Span is a mock span used in association with Tracer for testing purpose only.

func (*Span) AddEvent

func (ms *Span) AddEvent(ctx context.Context, name string, attrs ...otelkv.KeyValue)

AddEvent does nothing.

func (*Span) AddEventWithTimestamp

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

AddEvent does nothing.

func (*Span) End

func (ms *Span) End(options ...oteltrace.EndOption)

End puts the span into tracers ended spans.

func (*Span) IsRecording

func (ms *Span) IsRecording() bool

IsRecording always returns false for Span.

func (*Span) RecordError

func (ms *Span) RecordError(ctx context.Context, err error, opts ...oteltrace.ErrorOption)

RecordError does nothing.

func (*Span) SetAttribute

func (ms *Span) SetAttribute(key string, value interface{})

SetAttribute adds a single inferred attribute.

func (*Span) SetAttributes

func (ms *Span) SetAttributes(attributes ...otelkv.KeyValue)

SetAttributes adds an attribute to Attributes member.

func (*Span) SetName

func (ms *Span) SetName(name string)

SetName sets the span name.

func (*Span) SetStatus

func (ms *Span) SetStatus(status codes.Code, msg string)

SetStatus sets the Status member.

func (*Span) SpanContext

func (ms *Span) SpanContext() oteltrace.SpanContext

SpanContext returns associated oteltrace.SpanContext.

If the receiver is nil it returns an empty oteltrace.SpanContext.

func (*Span) Tracer

func (ms *Span) Tracer() oteltrace.Tracer

Tracer returns the mock tracer implementation of Tracer.

type Tracer

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

	// Name of the tracer, received from the provider.
	Name string

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

	// OnSpanStarted is called every time a new span is started.
	OnSpanStarted func(span *Span)
	// contains filtered or unexported fields
}

Tracer is a simple tracer used for testing purpose only. SpanID is atomically increased every time a new span is created.

func NewTracer

func NewTracer(name string) *Tracer

func (*Tracer) EndedSpans

func (mt *Tracer) EndedSpans() []*Span

func (*Tracer) Start

Start starts a new Span and puts it into the context.

The function generates a new random TraceID if either there is no parent SpanContext in context or the WithNewRoot option is passed to the function. Otherwise the function will take the TraceID from parent SpanContext.

Currently no other StartOption has any effect here.

func (*Tracer) WithSpan

func (mt *Tracer) WithSpan(ctx context.Context, name string, body func(context.Context) error, opts ...oteltrace.StartOption) error

WithSpan does nothing except creating a new span and executing the body.

Jump to

Keyboard shortcuts

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