otlptest

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunEndToEndTest

func RunEndToEndTest(ctx context.Context, t *testing.T, exp *otlp.Exporter, mcTraces, mcMetrics Collector)

RunEndToEndTest can be used by protocol driver tests to validate themselves.

func SingleSpanSnapshot

func SingleSpanSnapshot() []*exporttrace.SpanSnapshot

SingleSpanSnapshot returns a one-element slice with a snapshot. It may be useful for testing driver's trace export.

Types

type Collector

type Collector interface {
	Stop() error
	GetResourceSpans() []*tracepb.ResourceSpans
	GetMetrics() []*metricpb.Metric
}

Collector is an interface that mock collectors should implements, so they can be used for the end-to-end testing.

type EmptyCheckpointSet

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

EmptyCheckpointSet is a checkpointer that has no records at all.

func (EmptyCheckpointSet) ForEach

func (EmptyCheckpointSet) ForEach(kindSelector exportmetric.ExportKindSelector, recordFunc func(exportmetric.Record) error) error

ForEach implements exportmetric.CheckpointSet. It never invokes the callback.

func (EmptyCheckpointSet) Lock

func (EmptyCheckpointSet) Lock()

Lock implements sync.Locker, which is needed for exportmetric.CheckpointSet.

func (EmptyCheckpointSet) RLock

func (EmptyCheckpointSet) RLock()

RLock implements exportmetric.CheckpointSet.

func (EmptyCheckpointSet) RUnlock

func (EmptyCheckpointSet) RUnlock()

RUnlock implements exportmetric.CheckpointSet.

func (EmptyCheckpointSet) Unlock

func (EmptyCheckpointSet) Unlock()

Unlock implements sync.Locker, which is needed for exportmetric.CheckpointSet.

type FailCheckpointSet

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

FailCheckpointSet is a checkpointer that returns an error during ForEach.

func (FailCheckpointSet) ForEach

func (FailCheckpointSet) ForEach(kindSelector exportmetric.ExportKindSelector, recordFunc func(exportmetric.Record) error) error

ForEach implements exportmetric.CheckpointSet. It always fails.

func (FailCheckpointSet) Lock

func (FailCheckpointSet) Lock()

Lock implements sync.Locker, which is needed for exportmetric.CheckpointSet.

func (FailCheckpointSet) RLock

func (FailCheckpointSet) RLock()

RLock implements exportmetric.CheckpointSet.

func (FailCheckpointSet) RUnlock

func (FailCheckpointSet) RUnlock()

RUnlock implements exportmetric.CheckpointSet.

func (FailCheckpointSet) Unlock

func (FailCheckpointSet) Unlock()

Unlock implements sync.Locker, which is needed for exportmetric.CheckpointSet.

type MetricsStorage

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

MetricsStorage stores the metrics. Mock collectors could use it to store metrics they have received.

func NewMetricsStorage

func NewMetricsStorage() MetricsStorage

NewMetricsStorage creates a new metrics storage.

func (*MetricsStorage) AddMetrics

AddMetrics adds metrics to the metrics storage.

func (*MetricsStorage) GetMetrics

func (s *MetricsStorage) GetMetrics() []*metricpb.Metric

GetMetrics returns the stored metrics.

type OneRecordCheckpointSet

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

OneRecordCheckpointSet is a CheckpointSet that returns just one filled record. It may be useful for testing driver's metrics export.

func (OneRecordCheckpointSet) ForEach

func (OneRecordCheckpointSet) ForEach(kindSelector exportmetric.ExportKindSelector, recordFunc func(exportmetric.Record) error) error

ForEach implements exportmetric.CheckpointSet. It always invokes the callback once with always the same record.

func (OneRecordCheckpointSet) Lock

func (OneRecordCheckpointSet) Lock()

Lock implements sync.Locker, which is needed for exportmetric.CheckpointSet.

func (OneRecordCheckpointSet) RLock

func (OneRecordCheckpointSet) RLock()

RLock implements exportmetric.CheckpointSet.

func (OneRecordCheckpointSet) RUnlock

func (OneRecordCheckpointSet) RUnlock()

RUnlock implements exportmetric.CheckpointSet.

func (OneRecordCheckpointSet) Unlock

func (OneRecordCheckpointSet) Unlock()

Unlock implements sync.Locker, which is needed for exportmetric.CheckpointSet.

type SpansStorage

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

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

func NewSpansStorage

func NewSpansStorage() SpansStorage

NewSpansStorage creates a new spans storage.

func (*SpansStorage) AddSpans

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.

Jump to

Keyboard shortcuts

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