loadgen

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2025 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	protoloadgen.UnimplementedLoadGenServiceServer
	// contains filtered or unexported fields
}

Client for applying load on the services.

func NewLoadGenClient

func NewLoadGenClient(conf *ClientConfig) (*Client, error)

NewLoadGenClient creates a new client instance.

func (*Client) AppendBatch

func (c *Client) AppendBatch(ctx context.Context, batch *protoloadgen.Batch) (*emptypb.Empty, error)

AppendBatch appends a batch to the stream.

func (*Client) GetLimit

GetLimit reads the stream limit.

func (*Client) RegisterService added in v0.1.5

func (c *Client) RegisterService(server *grpc.Server)

RegisterService registers for the load-gen's GRPC services.

func (*Client) Run

func (c *Client) Run(ctx context.Context) error

Run applies load on the service.

func (*Client) SetLimit

func (c *Client) SetLimit(_ context.Context, limit *protoloadgen.Limit) (*emptypb.Empty, error)

SetLimit sets the stream limit.

func (*Client) WaitForReady

func (*Client) WaitForReady(context.Context) bool

WaitForReady waits for the service resources to initialize, so it is ready to answers requests. If the context ended before the service is ready, returns false.

type ClientConfig

type ClientConfig struct {
	Server     *connection.ServerConfig `mapstructure:"server"`
	Monitoring metrics.Config           `mapstructure:"monitoring" yaml:"monitoring"`

	Adapter     adapters.AdapterConfig  `mapstructure:",squash" yaml:",inline"`
	Stream      *workload.StreamOptions `mapstructure:"stream" yaml:"stream"`
	LoadProfile *workload.Profile       `mapstructure:"load-profile" yaml:"load-profile"`
	Limit       *adapters.GenerateLimit `mapstructure:"limit" yaml:"limit"`

	// Generate If omitted, all phases will be generated by default.
	Generate adapters.Phases `mapstructure:"generate" yaml:"generate"`
}

ClientConfig is a struct that contains the configuration for the client.

func DefaultClientConf

func DefaultClientConf() *ClientConfig

DefaultClientConf returns default config values for client testing.

type ServiceAdapter

type ServiceAdapter interface {
	// RunWorkload apply the generated workload.
	RunWorkload(ctx context.Context, txStream *workload.StreamWithSetup) error
	// Progress returns a value that indicates progress as the number grows.
	Progress() uint64
	// Supports specify which phases an adapter supports.
	Supports() adapters.Phases
}

ServiceAdapter encapsulates the common interface for adapters.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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