testutils

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewJaegerThriftUDPClient

func NewJaegerThriftUDPClient(hostPort string, protocolFactory thrift.TProtocolFactory) (*jaeger.AgentClient, io.Closer, error)

NewJaegerThriftUDPClient creates a new jaeger agent client that works like Jaeger client

func NewZipkinThriftUDPClient

func NewZipkinThriftUDPClient(hostPort string) (*agent.AgentClient, io.Closer, error)

NewZipkinThriftUDPClient creates a new zipking agent client that works like Jaeger client

Types

type InMemoryReporter

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

InMemoryReporter collects spans in memory

func NewInMemoryReporter

func NewInMemoryReporter() *InMemoryReporter

NewInMemoryReporter creates new InMemoryReporter

func (*InMemoryReporter) EmitBatch

func (i *InMemoryReporter) EmitBatch(batch *jaeger.Batch) (err error)

EmitBatch implements the corresponding method of the Reporter interface

func (*InMemoryReporter) EmitZipkinBatch

func (i *InMemoryReporter) EmitZipkinBatch(spans []*zipkincore.Span) error

EmitZipkinBatch implements the corresponding method of the Reporter interface

func (*InMemoryReporter) Spans

func (i *InMemoryReporter) Spans() []*jaeger.Span

Spans returns accumulated spans as a copied slice

func (*InMemoryReporter) ZipkinSpans

func (i *InMemoryReporter) ZipkinSpans() []*zipkincore.Span

ZipkinSpans returns accumulated Zipkin spans as a copied slice

type MockTCollector

type MockTCollector struct {
	Channel *tchannel.Channel

	ReturnErr bool
	// contains filtered or unexported fields
}

MockTCollector is a mock representation of Jaeger Collector.

func InitMockCollector

func InitMockCollector(t *testing.T) (*metricstest.Factory, *MockTCollector)

InitMockCollector initializes a MockTCollector fixture

func StartMockTCollector

func StartMockTCollector() (*MockTCollector, error)

StartMockTCollector runs a mock representation of Jaeger Collector. This function returns a started server, with a Channel that knows how to find that server, which can be used in clients or Jaeger tracer.

TODO we should refactor normal collector so it can be used in tests, with in-memory storage

func (*MockTCollector) AddBaggageRestrictions

func (s *MockTCollector) AddBaggageRestrictions(
	service string,
	restrictions []*baggage.BaggageRestriction,
)

AddBaggageRestrictions registers baggage restrictions for a service

func (*MockTCollector) AddSamplingStrategy

func (s *MockTCollector) AddSamplingStrategy(
	service string,
	strategy *sampling.SamplingStrategyResponse,
)

AddSamplingStrategy registers a sampling strategy for a service

func (*MockTCollector) Close

func (s *MockTCollector) Close()

Close stops/closes the underlying channel and server

func (*MockTCollector) GetJaegerBatches

func (s *MockTCollector) GetJaegerBatches() []*jaeger.Batch

GetJaegerBatches returns accumulated Jaeger batches

func (*MockTCollector) GetZipkinSpans

func (s *MockTCollector) GetZipkinSpans() []*zipkincore.Span

GetZipkinSpans returns accumulated Zipkin spans

func (*MockTCollector) SubmitBatches

func (s *MockTCollector) SubmitBatches(
	ctx thrift.Context,
	batches []*jaeger.Batch,
) ([]*jaeger.BatchSubmitResponse, error)

SubmitBatches implements handler method of TChanCollectorServer

func (*MockTCollector) SubmitZipkinBatch

func (s *MockTCollector) SubmitZipkinBatch(
	ctx thrift.Context,
	spans []*zipkincore.Span,
) ([]*zipkincore.Response, error)

SubmitZipkinBatch implements handler method of TChanZipkinCollectorServer

Jump to

Keyboard shortcuts

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