Documentation ¶
Index ¶
- func MeasurementQuery(cfg *Config, timestamp chan time.Time, results chan QueryResults)
- func NewSeries(m string, p int, sc int) series
- func Run(cfg *Config, done chan struct{}, ts chan time.Time) (totalPoints int, failedRequests int, responseTimes ResponseTimes, timer *Timer)
- func SeriesQuery(cfg *Config, done chan struct{}, results chan QueryResults)
- type ConcurrencyLimiter
- type Config
- type Measurements
- type QueryResults
- type ResponseTime
- type ResponseTimes
- type Timer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MeasurementQuery ¶
func MeasurementQuery(cfg *Config, timestamp chan time.Time, results chan QueryResults)
func NewSeries ¶
NewSeries, takes a measurement, and point count, and a series count and returns a series
func Run ¶
func Run(cfg *Config, done chan struct{}, ts chan time.Time) (totalPoints int, failedRequests int, responseTimes ResponseTimes, timer *Timer)
Run runs the stress test that is specified by a `Config`. It returns the total number of points that were during the test, an slice of all of the stress tests response times, and the times that the test started at and ended as a `Timer`
func SeriesQuery ¶
func SeriesQuery(cfg *Config, done chan struct{}, results chan QueryResults)
Types ¶
type ConcurrencyLimiter ¶
type ConcurrencyLimiter struct {
// contains filtered or unexported fields
}
ConcurrencyLimiter is a go routine safe struct that can be used to ensure that no more than a specifid max number of goroutines are executing.
func NewConcurrencyLimiter ¶
func NewConcurrencyLimiter(max int) *ConcurrencyLimiter
NewConcurrencyLimiter returns a configured limiter that will ensure that calls to Increment will block if the max is hit.
func (*ConcurrencyLimiter) Decrement ¶
func (c *ConcurrencyLimiter) Decrement()
Decrement will reduce the count of running goroutines by 1
func (*ConcurrencyLimiter) Increment ¶
func (c *ConcurrencyLimiter) Increment()
Increment will increase the count of running goroutines by 1. if the number is currently at the max, the call to Increment will block until another goroutine decrements.
type Config ¶
type Config struct { Write write `toml:"write"` Series []series `toml:"series"` MeasurementQuery measurementQuery `toml:"measurement_query"` SeriesQuery seriesQuery `toml:"series_query"` ChannelBufferSize int `toml:"channel_buffer_size"` SSL bool `toml:"ssl"` }
Config is a struct that is passed into the `Run()` function.
func DecodeFile ¶
DecodeFile takes a file path for a toml config file and returns a pointer to a Config Struct.
type Measurements ¶
type Measurements []string
func (*Measurements) Set ¶
func (ms *Measurements) Set(value string) error
Set implements the `Set` method for the flag.Value interface. Set splits a string of comma separated values into a `Measurement`.
func (*Measurements) String ¶
func (ms *Measurements) String() string
String returns a string and implements the `String` method for the flag.Value interface.
type QueryResults ¶
type QueryResults struct { TotalQueries int ResponseTimes ResponseTimes }
type ResponseTime ¶
ResponseTime is a struct that contains `Value` `Time` pairing.
func NewResponseTime ¶
func NewResponseTime(v int) ResponseTime
newResponseTime returns a new response time with value `v` and time `time.Now()`.
type ResponseTimes ¶
type ResponseTimes []ResponseTime
func (ResponseTimes) Len ¶
func (rs ResponseTimes) Len() int
Implements the `Len` method for the sort.Interface type
func (ResponseTimes) Less ¶
func (rs ResponseTimes) Less(i, j int) bool
Implements the `Less` method for the sort.Interface type
func (ResponseTimes) Swap ¶
func (rs ResponseTimes) Swap(i, j int)
Implements the `Swap` method for the sort.Interface type
type Timer ¶
type Timer struct {
// contains filtered or unexported fields
}
Timer is struct that can be used to track elaspsed time
func NewTimer ¶
func NewTimer() *Timer
NewTimer returns a pointer to a `Timer` struct where the timers `start` field has been set to `time.Now()`
func (*Timer) Elapsed ¶
Elapsed returns the total elapsed time between the `start` and `end` fields on a timer.
func (*Timer) StartTimer ¶
func (t *Timer) StartTimer()
StartTimer sets a timers `start` field to the current time