stressClient - ActiveState ActiveGo 1.8
...

Package stressClient

import "github.com/influxdata/influxdb/stress/v2/stress_client"
Overview
Index

Overview ▾

type ConcurrencyLimiter

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

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

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

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

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

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

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

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

func NewPackage

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

NewPackage creates a new package with the appropriate payload

type Response

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

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

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

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

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
}

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

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

type Tracer struct {
    Tags map[string]string

    sync.WaitGroup
}

func NewTracer

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

NewTracer returns a Tracer with tags attached

type Type

Type refers to the different Package types

type Type int

There are two package types, Write and Query

const (
    Write Type = iota
    Query
)