request

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClients

func NewClients(kubeCfgPath string, connsNum int, opts ...ClientCfgOpt) ([]rest.Interface, error)

NewClients creates N rest.Interface.

FIXME(weifu):

1. Is it possible to build one http2 client with multiple connections? 2. How to monitor HTTP2 GOAWAY frame?

Types

type ClientCfgOpt added in v0.0.2

type ClientCfgOpt func(*clientCfg)

ClientCfgOpt is used to update default client setting.

func WithClientContentTypeOpt added in v0.0.2

func WithClientContentTypeOpt(ct types.ContentType) ClientCfgOpt

WithClientContentTypeOpt updates content type of response.

func WithClientDisableHTTP2Opt added in v0.0.2

func WithClientDisableHTTP2Opt(b bool) ClientCfgOpt

WithClientDisableHTTP2Opt disables HTTP2 protocol.

func WithClientQPSOpt added in v0.0.2

func WithClientQPSOpt(qps float64) ClientCfgOpt

WithClientQPSOpt updates QPS value.

func WithClientUserAgentOpt added in v0.0.2

func WithClientUserAgentOpt(ua string) ClientCfgOpt

WithClientUserAgentOpt updates user agent.

type RESTRequestBuilder

type RESTRequestBuilder interface {
	Build(cli rest.Interface) (method string, _ *rest.Request)
}

RESTRequestBuilder is used to build rest.Request.

type Result added in v0.0.2

type Result struct {
	types.ResponseStats
	// Duration means the time of benchmark.
	Duration time.Duration
	// Total means the total number of requests.
	Total int
}

Result contains responseStats vlaues from Gather() and adds Duration and Total values separately

func Schedule

func Schedule(ctx context.Context, spec *types.LoadProfileSpec, restCli []rest.Interface) (*Result, error)

Schedule files requests to apiserver based on LoadProfileSpec.

type WeightedRandomRequests

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

WeightedRandomRequests is used to generate requests based on LoadProfileSpec.

func NewWeightedRandomRequests

func NewWeightedRandomRequests(spec *types.LoadProfileSpec) (*WeightedRandomRequests, error)

NewWeightedRandomRequests creates new instance of WeightedRandomRequests.

func (*WeightedRandomRequests) Chan

Chan returns channel to get random request.

func (*WeightedRandomRequests) Run

func (r *WeightedRandomRequests) Run(ctx context.Context, total int)

Run starts to random pick request.

func (*WeightedRandomRequests) Stop

func (r *WeightedRandomRequests) Stop()

Stop stops request generator.

Jump to

Keyboard shortcuts

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