tracer

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(recorder SpanRecorder) ot.Tracer

New creates and returns a standard Tracer which defers completed Spans to `recorder`.

Types

type InMemorySpanRecorder

type InMemorySpanRecorder struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

InMemorySpanRecorder stores spans using a slice in a thread-safe way

func NewInMemoryRecorder

func NewInMemoryRecorder() *InMemorySpanRecorder

NewInMemoryRecorder creates new InMemorySpanRecorder

func (*InMemorySpanRecorder) GetSpans

func (r *InMemorySpanRecorder) GetSpans() []*RawSpan

GetSpans returns a copy of the array of spans accumulated so far.

func (*InMemorySpanRecorder) RecordSpan

func (r *InMemorySpanRecorder) RecordSpan(span *RawSpan)

RecordSpan implements the respective method of SpanRecorder.

func (*InMemorySpanRecorder) Reset

func (r *InMemorySpanRecorder) Reset()

Reset clears the internal array of spans.

type RawSpan

type RawSpan struct {
	Context        SpanContext
	ParentSpanID   string
	OperationName  string
	StartTimestamp int64
	EndTimestamp   int64
	DomainName     string
	ClassName      string
	Tags           ot.Tags
	Logs           []ot.LogRecord
}

RawSpan encapsulates all state associated with a (finished) Span.

func GetRaw

func GetRaw(ots ot.Span) (*RawSpan, bool)

GetRaw casts opentracing span interface to spanImpl struct

func (*RawSpan) Duration

func (s *RawSpan) Duration() int64

Duration calculates the spans duration

func (*RawSpan) GetTags

func (s *RawSpan) GetTags() ot.Tags

GetTags filters the thundra tags and returns the remainings

type SpanContext

type SpanContext struct {
	TransactionID string
	// A probabilistically unique identifier for a [multi-span] trace.
	TraceID string
	// A probabilistically unique identifier for a span.
	SpanID string
	// The span's associated baggage.
	Baggage map[string]string
}

SpanContext holds the basic Span metadata.

func (SpanContext) ForeachBaggageItem

func (c SpanContext) ForeachBaggageItem(handler func(k, v string) bool)

ForeachBaggageItem belongs to the opentracing.SpanContext interface

func (SpanContext) WithBaggageItem

func (c SpanContext) WithBaggageItem(key, val string) SpanContext

WithBaggageItem returns an entirely new basictracer SpanContext with the given key:value baggage pair set.

type SpanRecorder

type SpanRecorder interface {
	GetSpans() []*RawSpan
	RecordSpan(span *RawSpan)
	Reset()
}

SpanRecorder handles all of the `RawSpan` data generated via an associated `Tracer`

Source Files

  • raw_span.go
  • recorder.go
  • span.go
  • span_context.go
  • tracer.go

Jump to

Keyboard shortcuts

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