Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotRunning = errors.New("coordinator is not running") ErrNotStopped = errors.New("coordinator has not stopped") ErrAlreadyDone = errors.New("coordinator is already done") )
State related errors.
var ErrInvalidState = errors.New("unknown state")
ErrInvalidState is returned when an unknown state variable is encoded/decoded.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // ClusterConfig defines the load-test agent cluster configuration. ClusterConfig cluster.LoadAgentClusterConfig // MonitorConfig holds the performance monitor configuration. MonitorConfig performance.MonitorConfig // The number of active users to increment at each iteration of the feedback loop. // It should be proportional to the maximum number of users expected to test. NumUsersInc int `default:"8" validate:"range:(0,]"` // The number of users to decrement at each iteration of the feedback loop. // It should be proportional to the maximum number of users expected to test. NumUsersDec int `default:"8" validate:"range:(0,]"` // The number of seconds to wait after a performance degradation alert before // incrementing or decrementing users again. RestTimeSec int `default:"2" validate:"range:(0,]"` LogSettings logger.Settings }
Config holds the necessary information to drive a cluster of load-test agents performing a load-test on a target instance.
func ReadConfig ¶
ReadConfig reads the configuration file from the given string. If the string is empty, it will return a config with default values.
type Coordinator ¶
type Coordinator struct {
// contains filtered or unexported fields
}
Coordinator is the object used to coordinate a cluster of load-test agents.
func New ¶
New creates and initializes a new Coordinator for the given config. The ltConfig parameter is used to create and configure load-test agents. An error is returned if the initialization fails.
func (*Coordinator) InjectAction ¶ added in v1.10.0
func (c *Coordinator) InjectAction(actionID string) error
InjectAction injects an action into all the agents that is run once, at the next possible opportunity.
func (*Coordinator) Run ¶
func (c *Coordinator) Run() (<-chan struct{}, error)
Run starts a cluster of load-test agents. It returns a channel to signal when the coordinator is done. It returns an error if the coordinator is not in Stopped state.
func (*Coordinator) Status ¶
func (c *Coordinator) Status() (Status, error)
Status returns the coordinator's status.
func (*Coordinator) Stop ¶
func (c *Coordinator) Stop() error
Stop stops the coordinator. It returns an error in case of failure.
type State ¶
type State int
State determines which state a Coordinator is in.
func (State) MarshalJSON ¶
MarshalJSON returns a JSON representation from a State variable.
func (*State) UnmarshalJSON ¶
UnmarshalJSON constructs the state from a JSON string.
type Status ¶
type Status struct { State State // State of Coordinator. StartTime time.Time // Time when Coordinator has started. StopTime time.Time // Time when Coordinator has stopped. ActiveUsers int // Total number of currently active users across the load-test agents cluster. NumErrors int64 // Total number of errors received from the load-test agents cluster. SupportedUsers int // Number of supported users. }
Status contains various information about Coordinator.