stressClient

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConcurrencyLimiter

type ConcurrencyLimiter struct {
	sync.Mutex
	// contains filtered or unexported fields
}

ConcurrencyLimiter ensures that no more than a specified max number of goroutines are running.

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.

func (*ConcurrencyLimiter) NewMax

func (c *ConcurrencyLimiter) NewMax(i int)

NewMax resets the max of a ConcurrencyLimiter.

type Directive

type Directive struct {
	Property string
	Value    string
	Tracer   *Tracer
}

Directive is a struct to enable communication between SetStatements and the stressClient backend Directives change state for the stress test

func NewDirective

func NewDirective(property string, value string, tracer *Tracer) Directive

NewDirective creates a new instance of a Directive with the appropriate state variable to change

type Package

type Package struct {
	T           Type
	Body        []byte
	StatementID string
	Tracer      *Tracer
}

Package is a struct to enable communication between InsertStatements, QueryStatements and InfluxQLStatements and the stressClient backend Packages carry either writes or queries in the []byte that makes up the Body

func NewPackage

func NewPackage(t Type, body []byte, statementID string, tracer *Tracer) Package

NewPackage creates a new package with the appropriate payload

type Response

type Response struct {
	Point  *influx.Point
	Tracer *Tracer
}

Response holds data scraped from InfluxDB HTTP responses turned into a *influx.Point for reporting See reporting.go for more information The Tracer contains a wait group sent from the statement. It needs to be decremented when the Response is consumed

func NewResponse

func NewResponse(pt *influx.Point, tr *Tracer) Response

NewResponse creates a new instance of Response

func (Response) AddTags

func (resp Response) AddTags(newTags map[string]string) (*influx.Point, error)

AddTags adds additional tags to the point held in Response and returns the point

type StressTest

type StressTest struct {
	TestID string
	TestDB string

	Precision string
	StartDate string
	BatchSize int

	sync.WaitGroup
	sync.Mutex

	ResultsChan chan Response

	ResultsClient influx.Client
	// contains filtered or unexported fields
}

The StressTest is the Statement facing API that consumes Statement output and coordinates the test results

func NewStressTest

func NewStressTest() *StressTest

NewStressTest creates the backend for the stress test

func NewTestStressTest

func NewTestStressTest() (*StressTest, chan Package, chan Directive)

NewTestStressTest returns a StressTest to be used for testing Statements

func (*StressTest) GetPoint

func (st *StressTest) GetPoint(name, precision string) models.Point

GetPoint is called by a QueryStatement and retrieves a point sent by the associated InsertStatement

func (*StressTest) GetStatementResults

func (st *StressTest) GetStatementResults(sID, t string) (res []influx.Result)

GetStatementResults is a convinence function for fetching all results given a StatementID

func (*StressTest) NewResultsPointBatch

func (st *StressTest) NewResultsPointBatch() influx.BatchPoints

NewResultsPointBatch creates a new batch of points for the results

func (*StressTest) SendDirective

func (st *StressTest) SendDirective(d Directive)

SendDirective is the public facing API to set state variables in the test

func (*StressTest) SendPackage

func (st *StressTest) SendPackage(p Package)

SendPackage is the public facing API for to send Queries and Points

func (*StressTest) SetCommune

func (st *StressTest) SetCommune(name string) chan<- string

SetCommune creates a new commune on the StressTest

type Tracer

type Tracer struct {
	Tags map[string]string

	sync.WaitGroup
}

The Tracer carrys tags and a waitgroup from the statements through the package life cycle

func NewTracer

func NewTracer(tags map[string]string) *Tracer

NewTracer returns a Tracer with tags attached

type Type

type Type int

Type refers to the different Package types

const (
	Write Type = iota
	Query
)

There are two package types, Write and Query

Jump to

Keyboard shortcuts

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