statement

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2017 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecStatement

type ExecStatement struct {
	StatementID string
	Script      string
	// contains filtered or unexported fields
}

ExecStatement run outside scripts. This functionality is not built out TODO: Wire up!

func (*ExecStatement) Report

func (i *ExecStatement) Report(s *stressClient.StressTest) string

Report statisfies the Statement Interface

func (*ExecStatement) Run

func (i *ExecStatement) Run(s *stressClient.StressTest)

Run statisfies the Statement Interface

func (*ExecStatement) SetID

func (i *ExecStatement) SetID(s string)

SetID statisfies the Statement Interface

type Function

type Function struct {
	Type     string
	Fn       string
	Argument int
	Count    int
}

Function is a struct that holds information for generating values in templated points

func (*Function) NewStringer

func (f *Function) NewStringer(series int) Stringer

NewStringer creates a new Stringer

type GoStatement

type GoStatement struct {
	Statement

	StatementID string
}

GoStatement is a Statement Implementation to allow other statements to be run concurrently

func (*GoStatement) Report

func (i *GoStatement) Report(s *stressClient.StressTest) string

Report statisfies the Statement Interface

func (*GoStatement) Run

func (i *GoStatement) Run(s *stressClient.StressTest)

Run statisfies the Statement Interface

func (*GoStatement) SetID

func (i *GoStatement) SetID(s string)

SetID statisfies the Statement Interface

type InfluxqlStatement

type InfluxqlStatement struct {
	StatementID string
	Query       string
	Tracer      *stressClient.Tracer
}

InfluxqlStatement is a Statement Implementation that allows statements that parse in InfluxQL to be passed directly to the target instance

func (*InfluxqlStatement) Report

func (i *InfluxqlStatement) Report(s *stressClient.StressTest) (out string)

Report statisfies the Statement Interface No test coverage, fix

func (*InfluxqlStatement) Run

func (i *InfluxqlStatement) Run(s *stressClient.StressTest)

Run statisfies the Statement Interface

func (*InfluxqlStatement) SetID

func (i *InfluxqlStatement) SetID(s string)

SetID statisfies the Statement Interface

type InsertStatement

type InsertStatement struct {
	TestID      string
	StatementID string

	// Statement Name
	Name string

	// Template string for points. Filled by the output of stringers
	TemplateString string

	// TagCount is used to find the number of series in the dataset
	TagCount int

	// The Tracer prevents InsertStatement.Run() from returning early
	Tracer *stressClient.Tracer

	// Timestamp is #points to write and percision
	Timestamp *Timestamp

	// Templates turn into stringers
	Templates Templates

	// Concurrency utiliities
	sync.WaitGroup
	sync.Mutex
	// contains filtered or unexported fields
}

InsertStatement is a Statement Implementation that creates points to be written to the target InfluxDB instance

func (*InsertStatement) Report

func (i *InsertStatement) Report(s *stressClient.StressTest) string

Report statisfies the Statement Interface

func (*InsertStatement) Run

func (i *InsertStatement) Run(s *stressClient.StressTest)

Run statisfies the Statement Interface

func (*InsertStatement) SetID

func (i *InsertStatement) SetID(s string)

SetID statisfies the Statement Interface

func (*InsertStatement) SetVars

func (i *InsertStatement) SetVars(s *stressClient.StressTest) chan<- string

SetVars sets up the environment for InsertStatement to call it's Run function

type QueryStatement

type QueryStatement struct {
	StatementID string
	Name        string

	// TemplateString is a query template that can be filled in by Args
	TemplateString string
	Args           []string

	// Number of queries to run
	Count int

	// Tracer for tracking returns
	Tracer *stressClient.Tracer
	// contains filtered or unexported fields
}

QueryStatement is a Statement Implementation to run queries on the target InfluxDB instance

func (*QueryStatement) Report

func (i *QueryStatement) Report(s *stressClient.StressTest) string

Report statisfies the Statement Interface

func (*QueryStatement) Run

func (i *QueryStatement) Run(s *stressClient.StressTest)

Run statisfies the Statement Interface

func (*QueryStatement) SetID

func (i *QueryStatement) SetID(s string)

SetID statisfies the Statement Interface

type ResponseTime

type ResponseTime struct {
	Value int
	Time  time.Time
}

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

ResponseTimes is a slice of response times

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 SetStatement

type SetStatement struct {
	Var   string
	Value string

	StatementID string

	Tracer *stressClient.Tracer
}

SetStatement set state variables for the test

func (*SetStatement) Report

func (i *SetStatement) Report(s *stressClient.StressTest) string

Report statisfies the Statement Interface

func (*SetStatement) Run

func (i *SetStatement) Run(s *stressClient.StressTest)

Run statisfies the Statement Interface

func (*SetStatement) SetID

func (i *SetStatement) SetID(s string)

SetID statisfies the Statement Interface

type Statement

type Statement interface {
	Run(s *stressClient.StressTest)
	Report(s *stressClient.StressTest) string
	SetID(s string)
}

Statement is the common interface to shape the testing environment and prepare database requests The parser turns the 'statements' in the config file into Statements

type Stringer

type Stringer func() string

Stringer is a function that returns a string

func NewFloatFunc

func NewFloatFunc(fn string, arg int) Stringer

NewFloatFunc reates a new striger to create float values for templated writes

func NewIntFunc

func NewIntFunc(fn string, arg int) Stringer

NewIntFunc reates a new striger to create int values for templated writes

func NewStrFunc

func NewStrFunc(fn string, arg int) Stringer

NewStrFunc reates a new striger to create strings for templated writes

type Stringers

type Stringers []Stringer

Stringers is a collection of Stringer

func (Stringers) Eval

func (s Stringers) Eval(time func() int64) []interface{}

Eval returns an array of all the Stringer functions evaluated once

type Template

type Template struct {
	Tags     []string
	Function *Function
}

A Template contains all information to fill in templated variables in inset and query statements

func (*Template) NewTagFunc

func (t *Template) NewTagFunc() Stringer

NewTagFunc returns a Stringer that loops through the given tags

type Templates

type Templates []*Template

Templates are a collection of Template

func (Templates) Init

func (t Templates) Init(seriesCount int) Stringers

Init makes Stringers out of the Templates for quick point creation

type Timestamp

type Timestamp struct {
	Count    int
	Duration time.Duration
	Jitter   bool
}

A Timestamp contains all informaiton needed to generate timestamps for points created by InsertStatements

func (*Timestamp) Time

func (t *Timestamp) Time(startDate string, series int, precision string) func() int64

Time returns the next timestamp needed by the InsertStatement

type WaitStatement

type WaitStatement struct {
	StatementID string
	// contains filtered or unexported fields
}

WaitStatement is a Statement Implementation to prevent the test from returning to early when running GoStatements

func (*WaitStatement) Report

func (w *WaitStatement) Report(s *stressClient.StressTest) string

Report statisfies the Statement Interface

func (*WaitStatement) Run

func (w *WaitStatement) Run(s *stressClient.StressTest)

Run statisfies the Statement Interface

func (*WaitStatement) SetID

func (w *WaitStatement) SetID(s string)

SetID statisfies the Statement Interface

Jump to

Keyboard shortcuts

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