Documentation ¶
Index ¶
- func CustomDialer(ctx context.Context, network, addr string) (net.Conn, error)
- func SocketRun(hostURL string, timeout int, tests []*models.Test, dataIdx int, ...)
- type ContextKey
- type DataHandler
- type Runner
- type Socket
- type StatsReporter
- func (r *StatsReporter) ConnectDameon()
- func (r *StatsReporter) GetMinMax(val time.Duration, min float64, max float64) (float64, float64)
- func (r *StatsReporter) LogHitrate(hitrate *models.HitRate)
- func (r *StatsReporter) MakeHitRateStat(idx int, hitrate models.HitRate)
- func (r *StatsReporter) MeasureLatencies(hrStat *models.HitRateStats, metric *models.SocketStats)
- func (r *StatsReporter) Report(hrStat *models.HitRateStats)
- func (r *StatsReporter) ReportStatsd(metric *models.SocketStats)
- func (r *StatsReporter) Start()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CustomDialer ¶
CustomDialer ..need to figure how to pass ID & channel for this
Types ¶
type DataHandler ¶
type DataHandler struct{}
DataHandler handles all data
func (*DataHandler) ConstructDataConfig ¶
func (d *DataHandler) ConstructDataConfig(message json.RawMessage) []*models.TestDataConfig
ConstructDataConfig finds the index and CSV column frpom which data needs to be replaced in the test message string
func (*DataHandler) GetCSVData ¶
func (d *DataHandler) GetCSVData(path string, rows int) ([][]string, error)
GetCSVData reads the data file and populates a string array with the values
func (*DataHandler) PrepareTestData ¶
PrepareTestData prepares the test data for each test
type Runner ¶
type Runner struct { TestDoneChan chan bool SocketDoneChan chan bool SocketDoneCount int TotalCount int ErrChan chan error HostURL string ConnectTimeout int MaxDataLength int DataIndex int Tests []*models.Test HitRates []models.HitRate Flows []models.ConnectionBucket }
Runner Handles all the running of tests & running config
var TestRunner Runner
TestRunner singleton runner that will run tests
func (*Runner) CompleteNotify ¶
func (r *Runner) CompleteNotify()
CompleteNotify is notified when a socket test completes
func (*Runner) Initialize ¶
func (r *Runner) Initialize()
Initialize initializes the runner with config and channels
func (*Runner) OpenSocket ¶
OpenSocket opens a socket.. this was repeated code
func (*Runner) PrepareBuckets ¶
func (r *Runner) PrepareBuckets()
PrepareBuckets prepares buckets per second of number of socket connections to open
type Socket ¶
type Socket struct { Connection *websocket.Conn Dialer *websocket.Dialer SocketStats *models.SocketStats Context context.Context }
Socket = single socket connection to the host
type StatsReporter ¶
type StatsReporter struct { RateStats map[int]*models.HitRateStats AllStats *models.HitRateStats ReportChan chan *models.SocketStats TestDoneChan chan bool ReportString string HitrateString string TabWriter *tabwriter.Writer StatsdClient *statsd.StatsdClient StatsStrings struct { Success string Failure string ConnectLatency string DNSLatency string OverallLatency string } }
StatsReporter is the struct that holds all test stats
var Reporter StatsReporter
Reporter singleton object
func (*StatsReporter) ConnectDameon ¶
func (r *StatsReporter) ConnectDameon()
ConnectDameon connect reporter module to connect to any third party reporting tool like a statsd daemon
func (*StatsReporter) LogHitrate ¶
func (r *StatsReporter) LogHitrate(hitrate *models.HitRate)
LogHitrate logs the current hitrate
func (*StatsReporter) MakeHitRateStat ¶
func (r *StatsReporter) MakeHitRateStat(idx int, hitrate models.HitRate)
MakeHitRateStat makes a stat object based on the hitrate id
func (*StatsReporter) MeasureLatencies ¶
func (r *StatsReporter) MeasureLatencies(hrStat *models.HitRateStats, metric *models.SocketStats)
MeasureLatencies measures latencies when a metric comes in
func (*StatsReporter) Report ¶
func (r *StatsReporter) Report(hrStat *models.HitRateStats)
Report prints out the stats as they currently stand
func (*StatsReporter) ReportStatsd ¶
func (r *StatsReporter) ReportStatsd(metric *models.SocketStats)
ReportStatsd reporting latencies out to statsd
func (*StatsReporter) Start ¶
func (r *StatsReporter) Start()
Start starts the reporter to listen to any metric data coming on channel