testtrace

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 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 Event

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

Event encapsulates the properties of calls to AddEvent or AddEventWithTimestamp.

type Option added in v0.10.0

type Option interface {
	Apply(*config)
}

func WithSpanContextFunc added in v0.10.0

func WithSpanContextFunc(f func(context.Context) trace.SpanContext) Option

func WithSpanRecorder added in v0.10.0

func WithSpanRecorder(sr SpanRecorder) Option

type Provider added in v0.10.0

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

func NewProvider added in v0.10.0

func NewProvider(opts ...Option) *Provider

func (*Provider) Tracer added in v0.10.0

func (p *Provider) Tracer(instName string, opts ...trace.TracerOption) trace.Tracer

type Span

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

func (*Span) AddEvent

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

func (*Span) AddEventWithTimestamp

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

func (*Span) Attributes

func (s *Span) Attributes() map[kv.Key]kv.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

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

func (*Span) EndTime

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

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

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

func (s *Span) IsRecording() bool
func (s *Span) Links() map[trace.SpanContext][]kv.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

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

func (s *Span) ParentSpanID() trace.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) RecordError added in v0.2.3

func (s *Span) RecordError(ctx context.Context, err error, opts ...trace.ErrorOption)

func (*Span) SetAttribute added in v0.5.0

func (s *Span) SetAttribute(k string, v interface{})

func (*Span) SetAttributes

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

func (*Span) SetName

func (s *Span) SetName(name string)

func (*Span) SetStatus

func (s *Span) SetStatus(code codes.Code, msg string)

func (*Span) SpanContext

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

func (*Span) SpanKind added in v0.10.0

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

SpanKind returns the span kind of this span.

func (*Span) StartTime

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) StatusCode added in v0.3.0

func (s *Span) StatusCode() 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) StatusMessage added in v0.3.0

func (s *Span) StatusMessage() string

StatusMessage returns the status message most recently set on the Span or the empty string if no status mesaage was set.

func (*Span) Tracer

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

type SpanRecorder added in v0.10.0

type SpanRecorder interface {
	OnStart(*Span)
	OnEnd(*Span)
}

type StandardSpanRecorder added in v0.10.0

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

func (*StandardSpanRecorder) Completed added in v0.10.0

func (ssr *StandardSpanRecorder) Completed() []*Span

func (*StandardSpanRecorder) OnEnd added in v0.10.0

func (ssr *StandardSpanRecorder) OnEnd(span *Span)

func (*StandardSpanRecorder) OnStart added in v0.10.0

func (ssr *StandardSpanRecorder) OnStart(span *Span)

func (*StandardSpanRecorder) Started added in v0.10.0

func (ssr *StandardSpanRecorder) Started() []*Span

type Tracer

type Tracer struct {
	// Name is the instrumentation name.
	Name string
	// Version is the instrumentation version.
	Version string
	// contains filtered or unexported fields
}

Tracer is an OpenTelemetry Tracer implementation used for testing.

func (*Tracer) Start

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

func (*Tracer) WithSpan

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

Jump to

Keyboard shortcuts

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