cloudmock

package
v0.0.0-...-feb402c Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudMock

type CloudMock struct {
	TraceServiceClient  cloudtrace.TraceServiceClient
	MetricServiceClient monitoring.MetricServiceClient
	// contains filtered or unexported fields
}

CloudMock is the struct we will expose to users to use in their tests. It contains the gRPC clients for users to call, as well as the connection info to allow a graceful shutdown after the tests run.

func NewCloudMock

func NewCloudMock() *CloudMock

NewCloudMock is the constructor for the CloudMock struct, it will return a pointer to a new CloudMock.

func (*CloudMock) ClientConn

func (mock *CloudMock) ClientConn() *grpc.ClientConn

ClientConn is a getter to retrieve the client connection. This is used to provide the exporters with the address of our mock server.

func (*CloudMock) GetNumSpans

func (mock *CloudMock) GetNumSpans() int

GetNumSpans returns the number of spans currently stored on the server.

func (*CloudMock) GetSpan

func (mock *CloudMock) GetSpan(index int) *cloudtrace.Span

GetSpan returns the span that was stored in memory at the given index.

func (*CloudMock) SetDelay

func (mock *CloudMock) SetDelay(delay time.Duration)

SetDelay allows users to set the amount of time to delay before writing spans to memory.

func (*CloudMock) SetOnUpload

func (mock *CloudMock) SetOnUpload(onUpload func(ctx context.Context, spans []*cloudtrace.Span))

SetOnUpload allows users to set the onUpload function on the mock server, which is called before BatchWriteSpans runs.

func (*CloudMock) Shutdown

func (mock *CloudMock) Shutdown()

Shutdown closes the connections and shuts down the gRPC server.

Jump to

Keyboard shortcuts

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