pkg

package
v0.0.0-...-f63af33 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package pkg implements functions for executing load tests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Worker

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

Worker that manages ongoing attacks

func NewWorker

func NewWorker() *Worker

NewWorker instantiates and returns a Worker

func (*Worker) HandleMessageStart

func (w *Worker) HandleMessageStart(stream pb.Worker_CoordinateClient, msgRegister *pb.Start, mutex *sync.Mutex)

HandleMessageStart is the core function for executing a load test. It is called upon receiving a Start protobuf message from the leader. It leverages Vegeta and sends slices of metrics to the leader via stream. The mutex is used to enforce mutual exclusion for the stream.

func (*Worker) HandleMessageStop

func (w *Worker) HandleMessageStop(msgStop *pb.Stop)

HandleMessageStop is called upon receiving a Stop protobuf message from the leader. It sends a signal via a channel to stop the executing goroutine.

func (*Worker) Loop

func (w *Worker) Loop(streamMutex *sync.Mutex, stream pb.Worker_CoordinateClient, wg *sync.WaitGroup, timeMutex *sync.Mutex, lastProcessedTime *time.Time)

Loop is the main event loop of the worker. The worker polls for messages from the gRPC stream indefinitely, and processes each message.

func (*Worker) MetricsFromVegetaResult

func (w *Worker) MetricsFromVegetaResult(jobID string, res *vegeta.Result) *pb.Metrics

MetricsFromVegetaResult converts a Vegeta result into a Metrics protobuf

Jump to

Keyboard shortcuts

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