tracingtesting

package
v0.0.0-...-92c2bd7 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearSpanProcessor

func ClearSpanProcessor(t *testing.T, ctx context.Context)

func FetchNormalizedSpans

func FetchNormalizedSpans(t *testing.T, keepSpanID, keepTraceID, sortSpansByID bool) []map[string]any

func FetchOrderedSpans

func FetchOrderedSpans(sortSpansByID bool) []tracing.Span

func FetchTraces

func FetchTraces() []tracing.Trace

func RequireNoSpans

func RequireNoSpans(t *testing.T)

func RequireNoTraces

func RequireNoTraces(t *testing.T)

func Setup

func Setup(t *testing.T)

func SetupCtx

func SetupCtx(t *testing.T, ctx context.Context)

func SetupSpanProcessor

func SetupSpanProcessor()

func ShutdownTraceProvider

func ShutdownTraceProvider(ctx context.Context)

Types

type SpanProcessorEvent

type SpanProcessorEvent string
const (
	TraceStart SpanProcessorEvent = "trace_start"
	TraceEnd   SpanProcessorEvent = "trace_end"
	SpanStart  SpanProcessorEvent = "span_start"
	SpanEnd    SpanProcessorEvent = "span_end"
)

func FetchEvents

func FetchEvents() []SpanProcessorEvent

type SpanProcessorForTests

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

SpanProcessorForTests is a simple processor that stores finished spans in memory. This is concurrency-safe and suitable for tests or basic usage.

func NewSpanProcessorForTests

func NewSpanProcessorForTests() *SpanProcessorForTests

func SpanProcessorTesting

func SpanProcessorTesting() *SpanProcessorForTests

func (*SpanProcessorForTests) Clear

func (p *SpanProcessorForTests) Clear()

func (*SpanProcessorForTests) ForceFlush

func (p *SpanProcessorForTests) ForceFlush(context.Context) error

func (*SpanProcessorForTests) GetOrderedSpans

func (p *SpanProcessorForTests) GetOrderedSpans(includingEmpty, sortSpansByID bool) []tracing.Span

func (*SpanProcessorForTests) GetTraces

func (p *SpanProcessorForTests) GetTraces(includingEmpty bool) []tracing.Trace

func (*SpanProcessorForTests) OnSpanEnd

func (p *SpanProcessorForTests) OnSpanEnd(_ context.Context, span tracing.Span) error

func (*SpanProcessorForTests) OnSpanStart

func (*SpanProcessorForTests) OnTraceEnd

func (*SpanProcessorForTests) OnTraceStart

func (p *SpanProcessorForTests) OnTraceStart(_ context.Context, trace tracing.Trace) error

func (*SpanProcessorForTests) Shutdown

Jump to

Keyboard shortcuts

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