model

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrWrongHeaderFormat = errors.New("wrong header format")

Functions

This section is empty.

Types

type AggregatedStat

type AggregatedStat struct {
	Start    time.Time     `json:"start" db:"start"`
	End      time.Time     `json:"end" db:"end"`
	Duration time.Duration `json:"duration" db:"duration"`

	AvgRequestTime time.Duration `json:"avg_request_time" db:"avg_request_time"`
	MaxRequestTime time.Duration `json:"max_request_time" db:"max_request_time"`
	MinRequestTime time.Duration `json:"min_request_time" db:"min_request_time"`
	RequestCount   int           `json:"request_count" db:"request_count"`
}

AggregatedStat provides a average request time within a timeframe from start to end

type Headers

type Headers map[string][]string

func (Headers) Set

func (h Headers) Set(header string) error

Set header sets the header string into Headers map

type Loader

type Loader struct {
	UUID        string `db:"uuid" json:"uuid,omitempty"`
	URL         string `db:"url" json:"url"`
	Name        string `db:"name" json:"name,omitempty"`
	Method      string `db:"method" json:"method,omitempty"`
	HTTPEngine  string `db:"http_engine" json:"http_engine,omitempty"`
	Description string `db:"description" json:"description,omitempty"`

	CreateDate time.Time `db:"create_date" json:"create_date,omitempty"`

	SkipVerify bool   `db:"skip_verify" json:"skip_verify,omitempty"`
	CA         []byte `db:"ca" json:"ca,omitempty"`
	Cert       []byte `db:"cert" json:"cert,omitempty"`
	Key        []byte `db:"key" json:"key,omitempty"`

	Body []byte `db:"body" json:"body,omitempty"`

	GatherFullRequestsStats      bool `json:"gather_full_requests_stats,omitempty" db:"gather_full_requests_stats"`
	GatherAggregateRequestsStats bool `json:"gather_aggregate_requests_stats,omitempty" db:"gather_aggregate_requests_stats"`

	AggregateWindow  time.Duration `db:"aggregate_window" json:"aggregate_window,omitempty"`
	BenchmarkTimeout time.Duration `db:"benchmark_timeout" json:"benchmark_timeout,omitempty"`

	Headers    Headers    `json:"headers,omitempty"`
	Parameters Parameters `json:"parameters,omitempty"`

	Tags []*LoaderTag `json:"tags,omitempty"`

	LoaderReqDetails
}

Loader provides general settings for the loader benchmark They are constant within all time of benchmark execution

type LoaderReqDetails

type LoaderReqDetails struct {
	ID          int64 `db:"id" json:"-"`
	ReqCount    int   `db:"request_count" json:"request_count,omitempty"`
	AbortAfter  int   `db:"abort_after" json:"abort_after,omitempty"`
	Connections int   `db:"connections" json:"connections,omitempty"`
	RateLimit   int   `db:"rate_limit" json:"rate_limit,omitempty"` // How many requests per second is allowed

	Duration     time.Duration `db:"duration" json:"duration,omitempty"`
	KeepAlive    time.Duration `db:"keep_alive" json:"keep_alive,omitempty"`
	RequestDelay time.Duration `db:"request_delay" json:"request_delay,omitempty"`
	ReadTimeout  time.Duration `db:"read_timeout" json:"read_timeout,omitempty"`
	WriteTimeout time.Duration `db:"write_timeout" json:"write_timeout,omitempty"`
	Timeout      time.Duration `db:"timeout" json:"timeout,omitempty"`

	LoaderConfigurationUUID string `db:"loader_uuid" json:"loader_uuid,omitempty"`
}

type LoaderTag

type LoaderTag struct {
	Key   string `db:"key" json:"key,omitempty"`
	Value string `db:"value" json:"value,omitempty"`
}

type Parameters

type Parameters []map[string]string

func (*Parameters) Set

func (p *Parameters) Set(value string) error

value needs to in format "key1=value2&key2=value2

type RequestStat

type RequestStat struct {
	Start    time.Time     `json:"start" db:"start"`
	End      time.Time     `json:"end" db:"end"`
	Duration time.Duration `json:"duration" db:"duration"`

	BodySize int `json:"body_size" db:"body_size"`

	RetCode int    `json:"ret_code" db:"ret_code"`
	Error   string `json:"error" db:"error"`
}

RequestStat describe HTTP request status

type Summary

type Summary struct {
	UUID string `db:"uuid" json:"id"`
	URL  string `db:"url" json:"url"`

	Description string `db:"description" json:"description"`

	Start     time.Time     `db:"start" json:"start"`
	End       time.Time     `db:"end" json:"end"`
	TotalTime time.Duration `db:"total_time" json:"total_time"`

	ReqCount        int `db:"requests_count" json:"requests_count"`
	SuccessReq      int `db:"success_req" json:"success_req"` // Requests with return code 2x
	FailReq         int `db:"fail_req" json:"fail_req"`       // Requests with return code != 2x
	DataTransferred int `db:"data_transferred" json:"data_transferred"`

	ReqPerSec float64 `db:"req_per_sec" json:"req_per_sec"` // Request per second

	AvgReqTime time.Duration `db:"avg_req_time" json:"avg_req_time"` // Average request time
	MinReqTime time.Duration `db:"min_req_time" json:"min_req_time"` // Min request time
	MaxReqTime time.Duration `db:"max_req_time" json:"max_req_time"` // Max request time

	P50ReqTime time.Duration `db:"p50_req_time" json:"p_50_req_time"` // 50th percentile
	P75ReqTime time.Duration `db:"p75_req_time" json:"p_75_req_time"` // 75th percentile
	P90ReqTime time.Duration `db:"p90_req_time" json:"p_90_req_time"` // 90th percentile
	P99ReqTime time.Duration `db:"p99_req_time" json:"p_99_req_time"` // 99th percentile

	StdDeviation float64 `db:"std_deviation" json:"std_deviation"` // Standard deviation

	LoaderConf string `db:"loader_uuid" json:"-"`

	Errors    map[string]int `json:"errors,omitempty"`
	HTTPCodes map[int]int    `json:"http_codes,omitempty"`

	AggregatedStats []*AggregatedStat `json:"aggregated_stats,omitempty"`
	RequestStats    []*RequestStat    `json:"request_stats,omitempty"`
}

Jump to

Keyboard shortcuts

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