stress - ActiveState ActiveGo 1.8
...

Package stress

import "github.com/influxdata/influxdb/stress"
Overview
Index
Subdirectories

Overview ▾

Index ▾

func NewOutputConfig() *outputConfig
type AbstractField
type AbstractFields
    func (f AbstractFields) Template() (string, []string)
type AbstractTag
type AbstractTags
    func (t AbstractTags) Template() string
type BasicClient
    func (b *BasicClient) BasicWriteHandler(rs <-chan response, wt *Timer)
    func (c *BasicClient) Batch(ps <-chan Point, r chan<- response) error
type BasicPointGenerator
    func (b *BasicPointGenerator) Generate() (<-chan Point, error)
    func (b *BasicPointGenerator) Template() func(i int, t time.Time) *Pnt
    func (b *BasicPointGenerator) Time() time.Time
type BasicProvisioner
    func (b *BasicProvisioner) Provision() error
type BasicQuery
    func (q *BasicQuery) QueryGenerate(now func() time.Time) (<-chan Query, error)
    func (q *BasicQuery) SetTime(t time.Time)
type BasicQueryClient
    func (b *BasicQueryClient) BasicReadHandler(r <-chan response, rt *Timer)
    func (b *BasicQueryClient) Exec(qs <-chan Query, r chan<- response) error
    func (b *BasicQueryClient) Init() error
    func (b *BasicQueryClient) Query(cmd Query) (response, error)
type BroadcastChannel
    func NewBroadcastChannel() *BroadcastChannel
    func (b *BroadcastChannel) Broadcast(r response)
    func (b *BroadcastChannel) Close()
    func (b *BroadcastChannel) Handle(rs <-chan response, t *Timer)
    func (b *BroadcastChannel) Register(fn responseHandler)
type ConcurrencyLimiter
    func NewConcurrencyLimiter(max int) *ConcurrencyLimiter
    func (c *ConcurrencyLimiter) Decrement()
    func (c *ConcurrencyLimiter) Increment()
type Config
    func BasicStress() (*Config, error)
    func DecodeConfig(s string) (*Config, error)
    func DecodeFile(s string) (*Config, error)
    func NewConfig(s string) (*Config, error)
type Field
type Fields
type InfluxClient
type InfluxClients
type KeyValue
type Pnt
    func (p Pnt) Graphite() []byte
    func (p Pnt) Line() []byte
    func (p *Pnt) Next(i int, t time.Time)
    func (p Pnt) OpenJSON() []byte
    func (p Pnt) OpenTelnet() []byte
    func (p *Pnt) Set(b []byte)
type Point
type PointGenerator
type PointGenerators
type Provision
type Provisioner
type Querier
    func NewQuerier(q QueryGenerator, c QueryClient) Querier
type Query
type QueryClient
type QueryClients
type QueryGenerator
type QueryGenerators
type QueryResponse
    func (r QueryResponse) Success() bool
type Read
type ResponseTime
    func NewResponseTime(v int) ResponseTime
type ResponseTimes
    func (rs ResponseTimes) Len() int
    func (rs ResponseTimes) Less(i, j int) bool
    func (rs ResponseTimes) Swap(i, j int)
type StdPoint
    func (p StdPoint) Graphite() []byte
    func (p StdPoint) Line() []byte
    func (p StdPoint) OpenJSON() []byte
    func (p StdPoint) OpenTelnet() []byte
type StressTest
    func NewStressTest(p Provisioner, w Writer, r Querier) StressTest
    func (s *StressTest) Start(wHandle responseHandler, rHandle responseHandler)
type Tag
type Tags
type Timer
    func NewTimer() *Timer
    func (t *Timer) Elapsed() time.Duration
    func (t *Timer) End() time.Time
    func (t *Timer) Start() time.Time
    func (t *Timer) StartTimer()
    func (t *Timer) StopTimer()
type Write
type WriteResponse
type Writer
    func NewWriter(p PointGenerator, i InfluxClient) Writer

Package files

basic.go config.go run.go template.go util.go

func NewOutputConfig

func NewOutputConfig() *outputConfig

type AbstractField

AbstractField is a struct that abstractly defines a field

type AbstractField struct {
    Key  string `toml:"key"`
    Type string `toml:"type"`
}

type AbstractFields

AbstractFields is a slice of abstract fields

type AbstractFields []AbstractField

func (AbstractFields) Template

func (f AbstractFields) Template() (string, []string)

Template returns a templated string of fields

type AbstractTag

AbstractTag is a struct that abstractly defines a tag

type AbstractTag struct {
    Key   string `toml:"key"`
    Value string `toml:"value"`
}

type AbstractTags

AbstractTags is a slice of abstract tags

type AbstractTags []AbstractTag

func (AbstractTags) Template

func (t AbstractTags) Template() string

Template returns a templated string of tags

type BasicClient

BasicClient implements the InfluxClient interface.

type BasicClient struct {
    Enabled         bool     `toml:"enabled"`
    Addresses       []string `toml:"addresses"`
    Database        string   `toml:"database"`
    RetentionPolicy string   `toml:"retention-policy"`
    Precision       string   `toml:"precision"`
    BatchSize       int      `toml:"batch_size"`
    BatchInterval   string   `toml:"batch_interval"`
    Concurrency     int      `toml:"concurrency"`
    SSL             bool     `toml:"ssl"`
    Format          string   `toml:"format"`
    // contains filtered or unexported fields
}

func (*BasicClient) BasicWriteHandler

func (b *BasicClient) BasicWriteHandler(rs <-chan response, wt *Timer)

BasicWriteHandler handles write responses.

func (*BasicClient) Batch

func (c *BasicClient) Batch(ps <-chan Point, r chan<- response) error

Batch groups together points

type BasicPointGenerator

BasicPointGenerator implements the PointGenerator interface

type BasicPointGenerator struct {
    PointCount  int            `toml:"point_count"`
    Tick        string         `toml:"tick"`
    Jitter      bool           `toml:"jitter"`
    Measurement string         `toml:"measurement"`
    SeriesCount int            `toml:"series_count"`
    Tags        AbstractTags   `toml:"tag"`
    Fields      AbstractFields `toml:"field"`
    StartDate   string         `toml:"start_date"`
    Precision   string         `toml:"precision"`
    // contains filtered or unexported fields
}

func (*BasicPointGenerator) Generate

func (b *BasicPointGenerator) Generate() (<-chan Point, error)

Generate returns a point channel. Implements the Generate method for the PointGenerator interface

func (*BasicPointGenerator) Template

func (b *BasicPointGenerator) Template() func(i int, t time.Time) *Pnt

Template returns a function that returns a pointer to a Pnt.

func (*BasicPointGenerator) Time

func (b *BasicPointGenerator) Time() time.Time

Time returns the timestamp for the latest points that are being generated. Implements the Time method for the PointGenerator interface.

type BasicProvisioner

BasicProvisioner implements the Provisioner interface.

type BasicProvisioner struct {
    Enabled       bool   `toml:"enabled"`
    Address       string `toml:"address"`
    Database      string `toml:"database"`
    ResetDatabase bool   `toml:"reset_database"`
}

func (*BasicProvisioner) Provision

func (b *BasicProvisioner) Provision() error

Provision runs the resetDB function.

type BasicQuery

BasicQuery implements the QueryGenerator interface

type BasicQuery struct {
    Template   Query `toml:"template"`
    QueryCount int   `toml:"query_count"`
    // contains filtered or unexported fields
}

func (*BasicQuery) QueryGenerate

func (q *BasicQuery) QueryGenerate(now func() time.Time) (<-chan Query, error)

QueryGenerate returns a Query channel

func (*BasicQuery) SetTime

func (q *BasicQuery) SetTime(t time.Time)

SetTime sets the internal state of time

type BasicQueryClient

BasicQueryClient implements the QueryClient interface

type BasicQueryClient struct {
    Enabled       bool     `toml:"enabled"`
    Addresses     []string `toml:"addresses"`
    Database      string   `toml:"database"`
    QueryInterval string   `toml:"query_interval"`
    Concurrency   int      `toml:"concurrency"`
    // contains filtered or unexported fields
}

func (*BasicQueryClient) BasicReadHandler

func (b *BasicQueryClient) BasicReadHandler(r <-chan response, rt *Timer)

BasicReadHandler handles read responses.

func (*BasicQueryClient) Exec

func (b *BasicQueryClient) Exec(qs <-chan Query, r chan<- response) error

Exec listens to the query channel an executes queries as they come in

func (*BasicQueryClient) Init

func (b *BasicQueryClient) Init() error

Init initializes the InfluxDB client

func (*BasicQueryClient) Query

func (b *BasicQueryClient) Query(cmd Query) (response, error)

Query runs the query

type BroadcastChannel

type BroadcastChannel struct {
    // contains filtered or unexported fields
}

func NewBroadcastChannel

func NewBroadcastChannel() *BroadcastChannel

func (*BroadcastChannel) Broadcast

func (b *BroadcastChannel) Broadcast(r response)

func (*BroadcastChannel) Close

func (b *BroadcastChannel) Close()

func (*BroadcastChannel) Handle

func (b *BroadcastChannel) Handle(rs <-chan response, t *Timer)

func (*BroadcastChannel) Register

func (b *BroadcastChannel) Register(fn responseHandler)

type ConcurrencyLimiter

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.

type ConcurrencyLimiter struct {
    // 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.

type Config

Config is a struct for the Stress test configuration

type Config struct {
    Provision Provision `toml:"provision"`
    Write     Write     `toml:"write"`
    Read      Read      `toml:"read"`
}

func BasicStress

func BasicStress() (*Config, error)

BasicStress returns a config for a basic stress test.

func DecodeConfig

func DecodeConfig(s string) (*Config, error)

DecodeConfig takes a file path for a toml config file and returns a pointer to a Config Struct.

func DecodeFile

func DecodeFile(s string) (*Config, error)

DecodeFile takes a file path for a toml config file and returns a pointer to a Config Struct.

func NewConfig

func NewConfig(s string) (*Config, error)

NewConfig returns a pointer to a Config

type Field

Field is a struct for a field in influxdb.

type Field KeyValue

type Fields

Fields is an slice of all the fields for a point.

type Fields []Field

type InfluxClient

InfluxClient is an interface for writing data to the database.

type InfluxClient interface {
    Batch(ps <-chan Point, r chan<- response) error
    // contains filtered or unexported methods
}

type InfluxClients

InfluxClients is a struct that contains the configuration parameters for all implemented InfluxClient's.

type InfluxClients struct {
    Basic BasicClient `toml:"basic"`
}

type KeyValue

KeyValue is an intermediate type that is used to express Tag and Field similarly.

type KeyValue struct {
    Key   string
    Value string
}

type Pnt

Pnt is a struct that implements the Point interface.

type Pnt struct {
    // contains filtered or unexported fields
}

func (Pnt) Graphite

func (p Pnt) Graphite() []byte

Graphite returns a byte array for a point in graphite format.

func (Pnt) Line

func (p Pnt) Line() []byte

Line returns a byte array for a point in line protocol format.

func (*Pnt) Next

func (p *Pnt) Next(i int, t time.Time)

Next generates very simple points very efficiently. TODO: Take this out

func (Pnt) OpenJSON

func (p Pnt) OpenJSON() []byte

OpenJSON returns a byte array for a point in opentsdb json format

func (Pnt) OpenTelnet

func (p Pnt) OpenTelnet() []byte

OpenTelnet returns a byte array for a point in opentsdb-telnet format

func (*Pnt) Set

func (p *Pnt) Set(b []byte)

Set sets the internal state for a Pnt.

type Point

Point is an interface that is used to represent the abstract idea of a point in InfluxDB.

type Point interface {
    Line() []byte
    Graphite() []byte
    OpenJSON() []byte
    OpenTelnet() []byte
}

type PointGenerator

PointGenerator is an interface for generating points.

type PointGenerator interface {
    Generate() (<-chan Point, error)
    Time() time.Time
}

type PointGenerators

PointGenerators is a struct that contains the configuration parameters for all implemented PointGenerator's.

type PointGenerators struct {
    Basic *BasicPointGenerator `toml:"basic"`
}

type Provision

Provision is a struct that contains the configuration parameters for all implemented Provisioner's.

type Provision struct {
    Basic BasicProvisioner `toml:"basic"`
}

type Provisioner

Provisioner is an interface that provisions an InfluxDB instance

type Provisioner interface {
    Provision() error
}

type Querier

Querier queries the database.

type Querier struct {
    QueryGenerator
    QueryClient
}

func NewQuerier

func NewQuerier(q QueryGenerator, c QueryClient) Querier

NewQuerier returns a Querier.

type Query

Query is query

type Query string

type QueryClient

QueryClient is an interface that can write a query to an InfluxDB instance.

type QueryClient interface {
    Query(q Query) (response, error)
    Exec(qs <-chan Query, r chan<- response) error
}

type QueryClients

QueryClients is a struct that contains the configuration parameters for all implemented QueryClient's.

type QueryClients struct {
    Basic BasicQueryClient `toml:"basic"`
}

type QueryGenerator

QueryGenerator is an interface that is used to define queries that will be ran on the DB.

type QueryGenerator interface {
    QueryGenerate(f func() time.Time) (<-chan Query, error)
    SetTime(t time.Time)
}

type QueryGenerators

QueryGenerators is a struct that contains the configuration parameters for all implemented QueryGenerator's.

type QueryGenerators struct {
    Basic BasicQuery `toml:"basic"`
}

type QueryResponse

QueryResponse is a response for a Querier

type QueryResponse struct {
    Body string
    // contains filtered or unexported fields
}

func (QueryResponse) Success

func (r QueryResponse) Success() bool

Success returns true if the request was successful and false otherwise.

type Read

Read is a struct that contains the configuration parameters for the stress test Reader.

type Read struct {
    QueryGenerators QueryGenerators `toml:"query_generator"`
    QueryClients    QueryClients    `toml:"query_client"`
}

type ResponseTime

ResponseTime is a struct that contains `Value` `Time` pairing.

type ResponseTime struct {
    Value int
    Time  time.Time
}

func NewResponseTime

func NewResponseTime(v int) ResponseTime

NewResponseTime returns a new response time with value `v` and time `time.Now()`.

type ResponseTimes

ResponseTimes is a slice of response times

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 StdPoint

StdPoint represents a point in InfluxDB

type StdPoint struct {
    Measurement string
    Tags        Tags
    Fields      Fields
    Timestamp   int64
}

func (StdPoint) Graphite

func (p StdPoint) Graphite() []byte

Graphite returns a byte array for a point in graphite-protocol format

func (StdPoint) Line

func (p StdPoint) Line() []byte

Line returns a byte array for a point in line-protocol format

func (StdPoint) OpenJSON

func (p StdPoint) OpenJSON() []byte

OpenJSON returns a byte array for a point in JSON format

func (StdPoint) OpenTelnet

func (p StdPoint) OpenTelnet() []byte

OpenTelnet returns a byte array for a point in OpenTSDB-telnet format

type StressTest

StressTest is a struct that contains all of the logic required to execute a Stress Test

type StressTest struct {
    Provisioner
    Writer
    Querier
}

func NewStressTest

func NewStressTest(p Provisioner, w Writer, r Querier) StressTest

NewStressTest returns an instance of a StressTest

func (*StressTest) Start

func (s *StressTest) Start(wHandle responseHandler, rHandle responseHandler)

Start executes the Stress Test

type Tag

Tag is a struct for a tag in influxdb.

type Tag KeyValue

type Tags

Tags is an slice of all the tags for a point.

type Tags []Tag

type Timer

Timer is struct that can be used to track elaspsed time

type Timer struct {
    // contains filtered or unexported fields
}

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

func (t *Timer) Elapsed() time.Duration

Elapsed returns the total elapsed time between the `start` and `end` fields on a timer.

func (*Timer) End

func (t *Timer) End() time.Time

End returns a Timers end field

func (*Timer) Start

func (t *Timer) Start() time.Time

Start returns a Timers start field

func (*Timer) StartTimer

func (t *Timer) StartTimer()

StartTimer sets a timers `start` field to the current time

func (*Timer) StopTimer

func (t *Timer) StopTimer()

StopTimer sets a timers `end` field to the current time

type Write

Write is a struct that contains the configuration parameters for the stress test Writer.

type Write struct {
    PointGenerators PointGenerators `toml:"point_generator"`
    InfluxClients   InfluxClients   `toml:"influx_client"`
}

type WriteResponse

WriteResponse is a response for a Writer

type WriteResponse response

type Writer

Writer is a PointGenerator and an InfluxClient.

type Writer struct {
    PointGenerator
    InfluxClient
}

func NewWriter

func NewWriter(p PointGenerator, i InfluxClient) Writer

NewWriter returns a Writer.

Subdirectories