testing

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InMemoryExporter

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

InMemoryExporter is a span exporter that stores spans in memory for testing.

func NewInMemoryExporter

func NewInMemoryExporter() *InMemoryExporter

NewInMemoryExporter creates a new in-memory exporter.

func SetupTest

func SetupTest(t interface{ Helper() }) (*InMemoryExporter, func())

SetupTest initializes a test tracer provider with an in-memory exporter. Returns the exporter and a cleanup function.

func (*InMemoryExporter) ExportSpans

func (e *InMemoryExporter) ExportSpans(ctx context.Context, spans []sdktrace.ReadOnlySpan) error

ExportSpans stores spans in memory.

func (*InMemoryExporter) GetSpanByName

func (e *InMemoryExporter) GetSpanByName(name string) (sdktrace.ReadOnlySpan, bool)

GetSpanByName returns the first span with the given name.

func (*InMemoryExporter) GetSpans

func (e *InMemoryExporter) GetSpans() []sdktrace.ReadOnlySpan

GetSpans returns all exported spans.

func (*InMemoryExporter) Reset

func (e *InMemoryExporter) Reset()

Reset clears all stored spans.

func (*InMemoryExporter) Shutdown

func (e *InMemoryExporter) Shutdown(ctx context.Context) error

Shutdown implements the SpanExporter interface.

Jump to

Keyboard shortcuts

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