tracing

package
v0.0.0-...-5f09953 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SubmitAll

func SubmitAll(ctx context.Context, spans []Span)

func TraceToWriter

func TraceToWriter(ctx context.Context, w io.Writer, fn func(context.Context) error) error

func WithSpan

func WithSpan(ctx context.Context, span *Span) context.Context

func WithTracer

func WithTracer(ctx context.Context, tr Tracer) context.Context

Types

type MemoryTracer

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

func NewMemoryTracer

func NewMemoryTracer(ctx context.Context) *MemoryTracer

func (*MemoryTracer) Close

func (mt *MemoryTracer) Close() []Span

func (*MemoryTracer) Submit

func (mt *MemoryTracer) Submit(span *Span)

type Propagation

type Propagation struct {
	TraceId  string `json:"trace_id"`
	ParentId string `json:"parent_id"`
}

func PropagationFromContext

func PropagationFromContext(ctx context.Context) *Propagation

type Span

type Span struct {
	TraceId  string `json:"trace_id"`
	SpanId   string `json:"span_id"`
	ParentId string `json:"parent_id"`

	Name     string                 `json:"name"`
	Start    time.Time              `json:"start"`
	Duration time.Duration          `json:"duration"`
	Fields   map[string]interface{} `json:"fields"`
}

func CollectSpans

func CollectSpans(ctx context.Context, fn func(context.Context) error) ([]Span, error)

func SpanFromContext

func SpanFromContext(ctx context.Context) (*Span, bool)

type SpanBuilder

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

func StartPropagatedSpan

func StartPropagatedSpan(ctx context.Context, name string, p *Propagation) (context.Context, *SpanBuilder)

func StartSpan

func StartSpan(ctx context.Context, name string) (context.Context, *SpanBuilder)

func StartSpanInTrace

func StartSpanInTrace(ctx context.Context, name, trace, parent string) (context.Context, *SpanBuilder)

func (*SpanBuilder) AddField

func (sp *SpanBuilder) AddField(name string, v interface{})

func (*SpanBuilder) End

func (sp *SpanBuilder) End() *Span

func (*SpanBuilder) Id

func (sp *SpanBuilder) Id() string

func (*SpanBuilder) Propagation

func (sp *SpanBuilder) Propagation() *Propagation

func (*SpanBuilder) TraceId

func (sp *SpanBuilder) TraceId() string

func (*SpanBuilder) WillSubmit

func (sp *SpanBuilder) WillSubmit() bool

type Tracer

type Tracer interface {
	Submit(span *Span)
}

func TracerFromContext

func TracerFromContext(ctx context.Context) (Tracer, bool)

type WriterTracer

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

func WithWriterTracer

func WithWriterTracer(ctx context.Context, w io.Writer) (context.Context, *WriterTracer)

func (*WriterTracer) Close

func (wt *WriterTracer) Close() error

func (*WriterTracer) Submit

func (wt *WriterTracer) Submit(span *Span)

Jump to

Keyboard shortcuts

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