...

Package otlptracetest

import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlptracetest"
Overview
Index

Overview ▾

func RunEndToEndTest

func RunEndToEndTest(ctx context.Context, t *testing.T, exp *otlptrace.Exporter, tracesCollector TracesCollector)

RunEndToEndTest can be used by otlptrace.Client tests to validate themselves.

func RunExporterShutdownTest

func RunExporterShutdownTest(t *testing.T, factory func() otlptrace.Client)

func SingleReadOnlySpan

func SingleReadOnlySpan() []tracesdk.ReadOnlySpan

SingleReadOnlySpan returns a one-element slice with a read-only span. It may be useful for testing driver's trace export.

type SpansStorage

SpansStorage stores the spans. Mock collectors can use it to store spans they have received.

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

func NewSpansStorage

func NewSpansStorage() SpansStorage

NewSpansStorage creates a new spans storage.

func (*SpansStorage) AddSpans

func (s *SpansStorage) AddSpans(request *collectortracepb.ExportTraceServiceRequest)

AddSpans adds spans to the spans storage.

func (*SpansStorage) GetResourceSpans

func (s *SpansStorage) GetResourceSpans() []*tracepb.ResourceSpans

GetResourceSpans returns the stored resource spans.

func (*SpansStorage) GetSpans

func (s *SpansStorage) GetSpans() []*tracepb.Span

GetSpans returns the stored spans.

type TracesCollector

TracesCollector mocks a collector for the end-to-end testing.

type TracesCollector interface {
    Stop() error
    GetResourceSpans() []*tracepb.ResourceSpans
}