otel: go.opentelemetry.io/otel/api/trace/testtrace Index | Files

package testtrace

import "go.opentelemetry.io/otel/api/trace/testtrace"

Index

Package Files

event.go generator.go package.go span.go tracer.go

type CountGenerator Uses

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

CountGenerator is a simple Generator that can be used to create unique, albeit deterministic, trace and span IDs.

func NewCountGenerator Uses

func NewCountGenerator() *CountGenerator

func (*CountGenerator) SpanID Uses

func (g *CountGenerator) SpanID() core.SpanID

func (*CountGenerator) TraceID Uses

func (g *CountGenerator) TraceID() core.TraceID

type Event Uses

type Event struct {
    Timestamp  time.Time
    Name       string
    Attributes map[core.Key]core.Value
}

Event encapsulates the properties of calls to AddEvent or AddEventWithTimestamp.

type Generator Uses

type Generator interface {
    TraceID() core.TraceID
    SpanID() core.SpanID
}

type Span Uses

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

func (*Span) AddEvent Uses

func (s *Span) AddEvent(ctx context.Context, name string, attrs ...core.KeyValue)

func (*Span) AddEventWithTimestamp Uses

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

func (*Span) Attributes Uses

func (s *Span) Attributes() map[core.Key]core.Value

Attributes returns the attributes set on the Span, either at or after creation time. If the same attribute key was set multiple times, the last call will be used. Attributes cannot be changed after End has been called on the Span.

func (*Span) End Uses

func (s *Span) End(opts ...trace.EndOption)

func (*Span) EndTime Uses

func (s *Span) EndTime() (time.Time, bool)

EndTime returns the time at which the Span was ended if at has been ended, or false otherwise. If the span has been ended, the returned time will be the wall-clock time unless a specific end time was provided.

func (*Span) Ended Uses

func (s *Span) Ended() bool

Ended returns whether the Span has been ended, i.e., whether End has been called at least once on the Span.

func (*Span) Events Uses

func (s *Span) Events() []Event

Events returns the events set on the Span. Events cannot be changed after End has been called on the Span.

func (*Span) IsRecording Uses

func (s *Span) IsRecording() bool
func (s *Span) Links() map[core.SpanContext][]core.KeyValue

Links returns the links set on the Span at creation time. If multiple links for the same SpanContext were set, the last link will be used.

func (*Span) Name Uses

func (s *Span) Name() string

Name returns the name most recently set on the Span, either at or after creation time. It cannot be change after End has been called on the Span.

func (*Span) ParentSpanID Uses

func (s *Span) ParentSpanID() core.SpanID

ParentSpanID returns the SpanID of the parent Span. If the Span is a root Span and therefore does not have a parent, the returned SpanID will be invalid (i.e., it will contain all zeroes).

func (*Span) SetAttributes Uses

func (s *Span) SetAttributes(attrs ...core.KeyValue)

func (*Span) SetName Uses

func (s *Span) SetName(name string)

func (*Span) SetStatus Uses

func (s *Span) SetStatus(status codes.Code)

func (*Span) SpanContext Uses

func (s *Span) SpanContext() core.SpanContext

func (*Span) StartTime Uses

func (s *Span) StartTime() time.Time

StartTime returns the time at which the Span was started. This will be the wall-clock time unless a specific start time was provided.

func (*Span) Status Uses

func (s *Span) Status() codes.Code

Status returns the status most recently set on the Span, or codes.OK if no status has been explicitly set. It cannot be changed after End has been called on the Span.

func (*Span) Tracer Uses

func (s *Span) Tracer() trace.Tracer

type Tracer Uses

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

Tracer is a type of OpenTelemetry Tracer that tracks both active and ended spans, and which creates Spans that may be inspected to see what data has been set on them.

func NewTracer Uses

func NewTracer(opts ...TracerOption) *Tracer

func (*Tracer) Spans Uses

func (t *Tracer) Spans() []*Span

Spans returns the list of current and ended Spans started via the Tracer.

func (*Tracer) Start Uses

func (t *Tracer) Start(ctx context.Context, name string, opts ...trace.StartOption) (context.Context, trace.Span)

func (*Tracer) WithSpan Uses

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

type TracerOption Uses

type TracerOption func(*tracerConfig)

TracerOption enables configuration of a new Tracer.

func TracerWithGenerator Uses

func TracerWithGenerator(generator Generator) TracerOption

TracerWithGenerator enables customization of the Generator that the Tracer will use to create new trace and span IDs. By default, new Tracers will use the CountGenerator.

Package testtrace imports 8 packages (graph). Updated 2020-02-22. Refresh now. Tools for package owners.