http

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ResultTmpl = `` /* 1397-byte string literal not displayed */

)

Functions

This section is empty.

Types

type ElapsedInfo

type ElapsedInfo struct {
	Max float64 `json:"max,omitempty"`
	Min float64 `json:"min,omitempty"`
	Avg float64 `json:"avg,omitempty"`
}

type HttpBuilder

type HttpBuilder struct {
	HttpReq    *http.Request
	HttpClient *http.Client
	// contains filtered or unexported fields
}

func NewBuilder

func NewBuilder() *HttpBuilder

func (*HttpBuilder) CreateTask

func (builder *HttpBuilder) CreateTask(configArgs *config.ProtoConfigArgs) (string, error)

func (*HttpBuilder) Destroy added in v0.1.1

func (builder *HttpBuilder) Destroy(obj interface{}) error

func (*HttpBuilder) Done

func (builder *HttpBuilder) Done(total time.Duration) (interface{}, error)

func (*HttpBuilder) Init

func (builder *HttpBuilder) Init(ctx context.Context, taskReq *pb.ExecuteTaskRequest) error

func (*HttpBuilder) Merge

func (builder *HttpBuilder) Merge(messages []string) (interface{}, error)

func (*HttpBuilder) PostRequest

func (builder *HttpBuilder) PostRequest(result interface{}) error

func (*HttpBuilder) PreRequest

func (builder *HttpBuilder) PreRequest(taskReq *pb.ExecuteTaskRequest) (interface{}, interface{})

func (*HttpBuilder) Request

func (builder *HttpBuilder) Request(ctx context.Context, obj interface{}, taskReq *pb.ExecuteTaskRequest) interface{}

func (*HttpBuilder) Split

func (builder *HttpBuilder) Split(taskReq *pb.ExecuteTaskRequest, count int) []*pb.ExecuteTaskRequest

type HttpOptions added in v0.1.1

type HttpOptions struct {
	URL                string   `json:"url,omitempty"`
	HTTP2              bool     `json:"http2,omitempty"`
	Requests           int      `json:"requests,omitempty"`
	Method             string   `json:"method,omitempty"`
	ProxyAddr          string   `json:"proxyAddr,omitempty"`
	Headers            []string `json:"headers,omitempty"`
	Concurrency        int      `json:"concurrency,omitempty"`
	RateLimit          int      `json:"rateLimit,omitempty"`
	Timeout            int      `json:"timeout,omitempty"`
	Duration           int      `json:"duration,omitempty"`
	Body               string   `json:"body,omitempty"`
	BodyFile           string   `json:"bodyFile,omitempty"`
	ContentType        string   `json:"contentType,omitempty"`
	MaxResults         int      `json:"maxResults,omitempty"`
	DisableRedirects   bool     `json:"disableRedirects,omitempty"`
	DisableKeepAlive   bool     `json:"disableKeepAlive,omitempty"`
	DisableCompression bool     `json:"disableCompression,omitempty"`
}

HttpOptions contains http protocol runtime parameters

func NewHttpOptions added in v0.1.1

func NewHttpOptions() *HttpOptions

func (*HttpOptions) Validate added in v0.1.1

func (httpOpts *HttpOptions) Validate(args []string) error

type HttpStats

type HttpStats struct {
	TotalRequests int64 `json:"totalRequests,omitempty"`
	// Total time for running
	Duration       float64 `json:"duration,omitempty"`
	FastestReqTime float64 `json:"fastestReqTime,omitempty"`
	SlowestReqTime float64 `json:"slowestReqTime,omitempty"`
	AvgReqTime     float64 `json:"avgReqTime,omitempty"`
	// Average response size per request
	AvgSize int64 `json:"avgSize,omitempty"`
	// The sum of all response sizes
	TotalSize int64 `json:"totalSize,omitempty"`
	// Requests per second
	Rps           float64           `json:"rps,omitempty"`
	Dns           ElapsedInfo       `json:"dns,omitempty"`
	Delay         ElapsedInfo       `json:"delay,omitempty"`
	Resp          ElapsedInfo       `json:"resp,omitempty"`
	Conn          ElapsedInfo       `json:"conn,omitempty"`
	Req           ElapsedInfo       `json:"req,omitempty"`
	StatusCodes   map[uint32]uint32 `json:"statusCodes,omitempty"`
	ErrMap        map[string]uint32 `json:"errMap,omitempty"`
	ConnDuration  float64           `json:"connDuration,omitempty"`
	DnsDuration   float64           `json:"dnsDuration,omitempty"`
	ReqDuration   float64           `json:"reqDuration,omitempty"`
	RespDuration  float64           `json:"respDuration,omitempty"`
	DelayDuration float64           `json:"delayDuration,omitempty"`
	// Total number of requests
	Requests            int64                 `json:"requests,omitempty"`
	TotalDuration       float64               `json:"totalDuration,omitempty"`
	LatencyDistribution []LatencyDistribution `json:"latencyDistribution,omitempty"`
	// time spent per request
	Lats []float64 `json:"latencies,omitempty"`
}

type LatencyDistribution

type LatencyDistribution struct {
	Percentage uint32  `json:"percentage,omitempty"`
	Latency    float64 `json:"latency,omitempty"`
}

Jump to

Keyboard shortcuts

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