client

package
v0.14.6 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TotalStr = "Total"
)

Variables

This section is empty.

Functions

func IsValidURL

func IsValidURL(urlStr string) bool

IsValidURL checks if string is valid URL

func NewSleepLimited added in v0.14.3

func NewSleepLimited(d time.Duration) ratelimit.Limiter

NewSleepLimited returns a RateLimiter that is sleep limited.

func OutPutJSON added in v0.14.5

func OutPutJSON(fileName string, metrics ResultMetrics, metricsGroup map[string]ResultMetrics) error

func OutPutResults added in v0.14.5

func OutPutResults(metrics ResultMetrics)

func SplitHeader

func SplitHeader(header string) (int, []string)

SplitHeader splits string on colon and return a slice

Types

type Cassowary

type Cassowary struct {
	IsTLS                 bool
	BaseURL               string
	ExportMetrics         bool
	ExportMetricsFile     string
	PromExport            bool
	Cloudwatch            bool
	Histogram             bool
	Boxplot               bool
	StatFile              string
	TLSConfig             *tls.Config
	PromURL               string
	DisableTerminalOutput bool
	DisableKeepAlive      bool
	Client                *http.Client
	Bar                   *progressbar.ProgressBar
	Timeout               int

	Duration time.Duration
	Groups   []QueryGroup
	// contains filtered or unexported fields
}

Cassowary is the main struct with bootstraps the load test

func (*Cassowary) Coordinate

func (c *Cassowary) Coordinate() (ResultMetrics, map[string]ResultMetrics, error)

Coordinate bootstraps the load test based on values in Cassowary struct

func (*Cassowary) PlotBoxplot

func (c *Cassowary) PlotBoxplot(durations []float64) error

PlotBoxplot outputs a boxplot png

func (*Cassowary) PlotHistogram

func (c *Cassowary) PlotHistogram(durations []float64) error

PlotHistogram outputs a histogram png

func (*Cassowary) PushPrometheusMetrics

func (c *Cassowary) PushPrometheusMetrics(metrics ResultMetrics) error

PushPrometheusMetrics exports metrics to a PushGateway

func (*Cassowary) PutCloudwatchMetrics

func (c *Cassowary) PutCloudwatchMetrics(svc cloudwatchiface.CloudWatchAPI, metrics ResultMetrics) (*cloudwatch.PutMetricDataOutput, error)

PutCloudwatchMetrics exports metrics to AWS Cloudwatch

type Iterator

type Iterator interface {
	Next() *Query
}

type LoadTest added in v0.14.3

type LoadTest func(c *Cassowary, outPutChan chan<- durationMetrics, g *QueryGroup)

type Query added in v0.14.3

type Query struct {
	Name           string
	Method         string
	URL            string
	DataType       string
	Data           []byte // Body
	RequestHeaders [][2]string
	Validator      Validator // Custom Validator function
}

type QueryGroup added in v0.14.3

type QueryGroup struct {
	Name string

	ConcurrencyLevel int
	Delay            time.Duration
	Requests         int

	FileMode    bool
	URLPaths    []string
	URLIterator Iterator

	Method        string
	Data          []byte
	RequestHeader []string
	// contains filtered or unexported fields
}

type ResultMetrics

type ResultMetrics struct {
	Name              string         `json:"name"`
	BaseURL           string         `json:"base_url"`
	TotalRequests     int            `json:"total_requests"`
	FailedRequests    int            `json:"failed_requests"`
	RespSuccess       map[string]int `json:"responses_success"`
	RespFailed        map[string]int `json:"responses_failed"`
	RequestsPerSecond float64        `json:"requests_per_second"`
	DNSMedian         float64        `json:"dns_median"`
	ElapsedStats      stats          `json:"elapsed"`
	TCPStats          stats          `json:"tcp_connect"`
	ProcessingStats   stats          `json:"server_processing"`
	ContentStats      stats          `json:"content_transfer"`
	BodySize          stats          `json:"body_size"`
	RespSize          stats          `json:"resp_size"`
}

ResultMetrics are the aggregated metrics after the load test

type Validator added in v0.14.3

type Validator func(int, int64, []byte, error) (bool, string)

Validator(statusCode int, respSize int64, resp []byte, err error) (failed ool, statusCode string)

Jump to

Keyboard shortcuts

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