Documentation ¶
Overview ¶
Package pkg implements functions for executing load tests
Index ¶
- type Worker
- func (w *Worker) HandleMessageStart(stream pb.Worker_CoordinateClient, msgRegister *pb.Start, mutex *sync.Mutex)
- func (w *Worker) HandleMessageStop(msgStop *pb.Stop)
- func (w *Worker) Loop(streamMutex *sync.Mutex, stream pb.Worker_CoordinateClient, wg *sync.WaitGroup, ...)
- func (w *Worker) MetricsFromVegetaResult(jobID string, res *vegeta.Result) *pb.Metrics
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 (*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 ¶
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.