testtelemetry

package
v1.29.2 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryCollector

type MemoryCollector struct {
	ctrace.UnimplementedTraceServiceServer
	// contains filtered or unexported fields
}

MemoryCollector is a gRPC-based OTEL collector that collects spans in memory.

func StartMemoryCollector

func StartMemoryCollector(tb testing.TB) (*MemoryCollector, error)

func (*MemoryCollector) Addr

func (l *MemoryCollector) Addr() string

func (*MemoryCollector) Export

func (*MemoryCollector) Spans

func (l *MemoryCollector) Spans() []*trace.ResourceSpans

type MemoryExporter

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

MemoryExporter is a span exporter that collects spans in memory.

Note that internally it defers to otlptrace.Exporter to handle the actual export, since the code to transform spans to the exportable format is quite complex and not exported directly. By providing a custom "client", we can intercept the exported spans and write them to a file on request.

func NewFileExporter

func NewFileExporter(outDir string) *MemoryExporter

func (*MemoryExporter) ExportSpans

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

func (*MemoryExporter) Shutdown

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

func (*MemoryExporter) Write

func (e *MemoryExporter) Write(filename string) (string, error)

Jump to

Keyboard shortcuts

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