View Source
const (
	// ReasonNormalEnd indicates a normal end to the run
	ReasonNormalEnd = StopReason("normal")

	// ReasonCancel indicates end due to cancellation
	ReasonCancel = StopReason("cancel")

	// ReasonTimeout indicates run ended due to Z parameter timeout
	ReasonTimeout = StopReason("timeout")
View Source
const ScheduleConst = "const"

    ScheduleConst is a constant load schedule

    View Source
    const ScheduleLine = "line"

      ScheduleLine is the line load schedule

      View Source
      const ScheduleStep = "step"

        ScheduleStep is the step load schedule


        View Source
        var ErrEndStream = errors.New("ending stream")

          ErrEndStream is a signal from message providers that worker should close the stream It should not be used for erronous states

          View Source
          var ErrLastMessage = errors.New("last message")

            ErrLastMessage is a signal from message providers that the returned payload is the last one of the stream This is optional but encouraged for optimized performance Message payload returned along with this error must be valid and may not be nil


            func LoadConfig

            func LoadConfig(p string, c *Config) error

              LoadConfig loads the config from a file


              type BinaryDataFunc

              type BinaryDataFunc func(mtd *desc.MethodDescriptor, callData *CallData) []byte

                BinaryDataFunc is a function that can be used for provide binary data for request programatically. MethodDescriptor of the call is passed to the data function. CallData for the request is passed and can be used to access worker id, request number, etc...

                type Bucket

                type Bucket struct {
                	// The Mark for histogram bucket in seconds
                	Mark float64 `json:"mark"`
                	// The count in the bucket
                	Count int `json:"count"`
                	// The frequency of results in the bucket as a decimal percentage
                	Frequency float64 `json:"frequency"`

                  Bucket holds histogram data

                  type CallData

                  type CallData struct {
                  	WorkerID           string // unique worker ID
                  	RequestNumber      int64  // unique incremented request number for each request
                  	FullyQualifiedName string // fully-qualified name of the method call
                  	MethodName         string // shorter call method name
                  	ServiceName        string // the service name
                  	InputName          string // name of the input message type
                  	OutputName         string // name of the output message type
                  	IsClientStreaming  bool   // whether this call is client streaming
                  	IsServerStreaming  bool   // whether this call is server streaming
                  	Timestamp          string // timestamp of the call in RFC3339 format
                  	TimestampUnix      int64  // timestamp of the call as unix time in seconds
                  	TimestampUnixMilli int64  // timestamp of the call as unix time in milliseconds
                  	TimestampUnixNano  int64  // timestamp of the call as unix time in nanoseconds
                  	UUID               string // generated UUIDv4 for each call
                  	// contains filtered or unexported fields

                    CallData represents contextualized data available for templating

                    func (*CallData) ExecuteData

                    func (td *CallData) ExecuteData(data string) ([]byte, error)

                      ExecuteData applies the call data's parsed template and data string and returns the resulting buffer

                      func (*CallData) Regenerate

                      func (td *CallData) Regenerate() *CallData

                        Regenerate generates a new instance of call data from this parent instance The dynamic data like timestamps and UUIDs are re-filled

                        type Config

                        type Config struct {
                        	Proto                 string            `json:"proto" toml:"proto" yaml:"proto"`
                        	Protoset              string            `json:"protoset" toml:"protoset" yaml:"protoset"`
                        	Call                  string            `json:"call" toml:"call" yaml:"call"`
                        	RootCert              string            `json:"cacert" toml:"cacert" yaml:"cacert"`
                        	Cert                  string            `json:"cert" toml:"cert" yaml:"cert"`
                        	Key                   string            `json:"key" toml:"key" yaml:"key"`
                        	CountErrors           bool              `json:"count-errors" toml:"count-errors" yaml:"count-errors"`
                        	SkipTLSVerify         bool              `json:"skipTLS" toml:"skipTLS" yaml:"skipTLS"`
                        	SkipFirst             uint              `json:"skipFirst" toml:"skipFirst" yaml:"skipFirst"`
                        	CName                 string            `json:"cname" toml:"cname" yaml:"cname"`
                        	Authority             string            `json:"authority" toml:"authority" yaml:"authority"`
                        	Insecure              bool              `json:"insecure,omitempty" toml:"insecure,omitempty" yaml:"insecure,omitempty"`
                        	N                     uint              `json:"total" toml:"total" yaml:"total" default:"200"`
                        	Async                 bool              `json:"async,omitempty" toml:"async,omitempty" yaml:"async,omitempty"`
                        	C                     uint              `json:"concurrency" toml:"concurrency" yaml:"concurrency" default:"50"`
                        	CSchedule             string            `json:"concurrency-schedule" toml:"concurrency-schedule" yaml:"concurrency-schedule" default:"const"`
                        	CStart                uint              `json:"concurrency-start" toml:"concurrency-start" yaml:"concurrency-start" default:"1"`
                        	CEnd                  uint              `json:"concurrency-end" toml:"concurrency-end" yaml:"concurrency-end" default:"0"`
                        	CStep                 int               `json:"concurrency-step" toml:"concurrency-step" yaml:"concurrency-step" default:"0"`
                        	CStepDuration         Duration          `json:"concurrency-step-duration" toml:"concurrency-step-duration" yaml:"concurrency-step-duration" default:"0"`
                        	CMaxDuration          Duration          `json:"concurrency-max-duration" toml:"concurrency-max-duration" yaml:"concurrency-max-duration" default:"0"`
                        	Connections           uint              `json:"connections" toml:"connections" yaml:"connections" default:"1"`
                        	RPS                   uint              `json:"rps" toml:"rps" yaml:"rps"`
                        	Z                     Duration          `json:"duration" toml:"duration" yaml:"duration"`
                        	ZStop                 string            `json:"duration-stop" toml:"duration-stop" yaml:"duration-stop" default:"close"`
                        	X                     Duration          `json:"max-duration" toml:"max-duration" yaml:"max-duration"`
                        	Timeout               Duration          `json:"timeout" toml:"timeout" yaml:"timeout" default:"20s"`
                        	Data                  interface{}       `json:"data,omitempty" toml:"data,omitempty" yaml:"data,omitempty"`
                        	DataPath              string            `json:"data-file" toml:"data-file" yaml:"data-file"`
                        	BinData               []byte            `json:"-" toml:"-" yaml:"-"`
                        	BinDataPath           string            `json:"binary-file" toml:"binary-file" yaml:"binary-file"`
                        	Metadata              map[string]string `json:"metadata,omitempty" toml:"metadata,omitempty" yaml:"metadata,omitempty"`
                        	MetadataPath          string            `json:"metadata-file" toml:"metadata-file" yaml:"metadata-file"`
                        	SI                    Duration          `json:"stream-interval" toml:"stream-interval" yaml:"stream-interval"`
                        	StreamCallDuration    Duration          `json:"stream-call-duration" toml:"stream-call-duration" yaml:"stream-call-duration"`
                        	StreamCallCount       uint              `json:"stream-call-count" toml:"stream-call-count" yaml:"stream-call-count"`
                        	StreamDynamicMessages bool              `json:"stream-dynamic-messages" toml:"stream-dynamic-messages" yaml:"stream-dynamic-messages"`
                        	Output                string            `json:"output" toml:"output" yaml:"output"`
                        	Format                string            `json:"format" toml:"format" yaml:"format" default:"summary"`
                        	DialTimeout           Duration          `json:"connect-timeout" toml:"connect-timeout" yaml:"connect-timeout" default:"10s"`
                        	KeepaliveTime         Duration          `json:"keepalive" toml:"keepalive" yaml:"keepalive"`
                        	CPUs                  uint              `json:"cpus" toml:"cpus" yaml:"cpus"`
                        	ImportPaths           []string          `json:"import-paths,omitempty" toml:"import-paths,omitempty" yaml:"import-paths,omitempty"`
                        	Name                  string            `json:"name,omitempty" toml:"name,omitempty" yaml:"name,omitempty"`
                        	Tags                  map[string]string `json:"tags,omitempty" toml:"tags,omitempty" yaml:"tags,omitempty"`
                        	ReflectMetadata       map[string]string `json:"reflect-metadata,omitempty" toml:"reflect-metadata,omitempty" yaml:"reflect-metadata,omitempty"`
                        	Debug                 string            `json:"debug,omitempty" toml:"debug,omitempty" yaml:"debug,omitempty"`
                        	Host                  string            `json:"host" toml:"host" yaml:"host"`
                        	EnableCompression     bool              `json:"enable-compression,omitempty" toml:"enable-compression,omitempty" yaml:"enable-compression,omitempty"`
                        	LoadSchedule          string            `json:"load-schedule" toml:"load-schedule" yaml:"load-schedule" default:"const"`
                        	LoadStart             uint              `json:"load-start" toml:"load-start" yaml:"load-start"`
                        	LoadEnd               uint              `json:"load-end" toml:"load-end" yaml:"load-end"`
                        	LoadStep              int               `json:"load-step" toml:"load-step" yaml:"load-step"`
                        	LoadStepDuration      Duration          `json:"load-step-duration" toml:"load-step-duration" yaml:"load-step-duration"`
                        	LoadMaxDuration       Duration          `json:"load-max-duration" toml:"load-max-duration" yaml:"load-max-duration"`
                        	LBStrategy            string            `json:"lb-strategy" toml:"lb-strategy" yaml:"lb-strategy"`

                          Config for the run. TODO fix casing and consistency.

                          type Counter

                          type Counter struct {
                          	// contains filtered or unexported fields

                            Counter is an implementation of the request counter

                            func (*Counter) Get

                            func (c *Counter) Get() uint64

                              Get retrieves the current count

                              func (*Counter) Inc

                              func (c *Counter) Inc() uint64

                                Inc increases the current count

                                type DataProviderFunc

                                type DataProviderFunc func(*CallData) ([]*dynamic.Message, error)

                                  DataProviderFunc is the interface for providing data for calls For unary and server streaming calls it should return an array with a single element For client and bidi streaming calls it should return an array of messages to be used

                                  type Duration

                                  type Duration time.Duration

                                    Duration is our duration with TOML support

                                    func (Duration) MarshalJSON

                                    func (d Duration) MarshalJSON() ([]byte, error)

                                      MarshalJSON implements encoding JSONMarshaler

                                      func (Duration) MarshalText

                                      func (d Duration) MarshalText() ([]byte, error)

                                        MarshalText implements encoding.TextMarshaler

                                        func (Duration) String

                                        func (d Duration) String() string

                                        func (*Duration) UnmarshalJSON

                                        func (d *Duration) UnmarshalJSON(text []byte) error

                                          UnmarshalJSON is our custom unmarshaller with JSON support

                                          func (*Duration) UnmarshalText

                                          func (d *Duration) UnmarshalText(text []byte) error

                                            UnmarshalText is our custom unmarshaller with TOML support

                                            type LatencyDistribution

                                            type LatencyDistribution struct {
                                            	Percentage int           `json:"percentage"`
                                            	Latency    time.Duration `json:"latency"`

                                              LatencyDistribution holds latency distribution data

                                              type Logger

                                              type Logger interface {
                                              	Debug(args ...interface{})
                                              	Debugf(template string, args ...interface{})
                                              	Debugw(msg string, keysAndValues ...interface{})
                                              	Error(args ...interface{})
                                              	Errorf(template string, args ...interface{})
                                              	Errorw(msg string, keysAndValues ...interface{})

                                                Logger interface is the common logger interface for all of web

                                                type MetadataProviderFunc

                                                type MetadataProviderFunc func(*CallData) (*metadata.MD, error)

                                                  MetadataProviderFunc is the interface for providing metadadata for calls

                                                  type Option

                                                  type Option func(*RunConfig) error

                                                    Option controls some aspect of run

                                                    func WithAsync

                                                    func WithAsync(async bool) Option

                                                      WithAsync specifies the async option

                                                      func WithAuthority

                                                      func WithAuthority(authority string) Option

                                                        WithAuthority specifies the value to be used as the :authority pseudo-header. This only works with WithInsecure option.

                                                        func WithBinaryData

                                                        func WithBinaryData(data []byte) Option

                                                          WithBinaryData specifies the binary data

                                                          msg := &helloworld.HelloRequest{}
                                                          msg.Name = "bob"
                                                          binData, _ := proto.Marshal(msg)

                                                          func WithBinaryDataFromFile

                                                          func WithBinaryDataFromFile(path string) Option

                                                            WithBinaryDataFromFile specifies the binary data


                                                            func WithBinaryDataFunc

                                                            func WithBinaryDataFunc(data func(mtd *desc.MethodDescriptor, callData *CallData) []byte) Option

                                                              WithBinaryDataFunc specifies the binary data func which will be called on each request


                                                              func WithCPUs

                                                              func WithCPUs(c uint) Option

                                                                WithCPUs specifies the number of CPU's to be used


                                                                func WithCertificate

                                                                func WithCertificate(cert, key string) Option

                                                                  WithCertificate specifies the certificate options for the run

                                                                  WithCertificate("client.crt", "client.key")

                                                                  func WithClientLoadBalancing

                                                                  func WithClientLoadBalancing(strategy string) Option

                                                                    WithClientLoadBalancing specifies the LB strategy to use The strategies has to be self written and pre defined

                                                                    func WithConcurrency

                                                                    func WithConcurrency(c uint) Option

                                                                      WithConcurrency specifies the C (number of concurrent requests) option


                                                                      func WithConcurrencyDuration

                                                                      func WithConcurrencyDuration(duration time.Duration) Option

                                                                        WithConcurrencyDuration specifies the total concurrency adjustment duration

                                                                        func WithConcurrencyEnd

                                                                        func WithConcurrencyEnd(v uint) Option

                                                                          WithConcurrencyEnd specifies the concurrency end value for line or step schedule


                                                                          func WithConcurrencySchedule

                                                                          func WithConcurrencySchedule(schedule string) Option

                                                                            WithConcurrencySchedule specifies the concurrency adjustment schedule


                                                                            func WithConcurrencyStart

                                                                            func WithConcurrencyStart(v uint) Option

                                                                              WithConcurrencyStart specifies the concurrency start for line or step schedule


                                                                              func WithConcurrencyStep

                                                                              func WithConcurrencyStep(step int) Option

                                                                                WithConcurrencyStep specifies the concurrency step value or slope


                                                                                func WithConcurrencyStepDuration

                                                                                func WithConcurrencyStepDuration(duration time.Duration) Option

                                                                                  WithConcurrencyStepDuration specifies the concurrency step duration for step schedule

                                                                                  func WithConfig

                                                                                  func WithConfig(cfg *Config) Option

                                                                                    WithConfig uses the configuration to populate the RunConfig See also: WithConfigFromFile, WithConfigFromReader

                                                                                    func WithConfigFromFile

                                                                                    func WithConfigFromFile(file string) Option

                                                                                      WithConfigFromFile uses a configuration JSON file to populate the RunConfig


                                                                                      func WithConfigFromReader

                                                                                      func WithConfigFromReader(reader io.Reader) Option

                                                                                        WithConfigFromReader uses a reader containing JSON data to populate the RunConfig See also: WithConfigFromFile

                                                                                        func WithConnections

                                                                                        func WithConnections(c uint) Option

                                                                                          WithConnections specifies the number of gRPC connections to use


                                                                                          func WithCountErrors

                                                                                          func WithCountErrors(v bool) Option

                                                                                            WithCountErrors is the count errors option

                                                                                            func WithData

                                                                                            func WithData(data interface{}) Option

                                                                                              WithData specifies data as generic data that can be serailized to JSON

                                                                                              func WithDataFromFile

                                                                                              func WithDataFromFile(path string) Option

                                                                                                WithDataFromFile loads JSON data from file


                                                                                                func WithDataFromJSON

                                                                                                func WithDataFromJSON(data string) Option

                                                                                                  WithDataFromJSON loads JSON data from string


                                                                                                  func WithDataFromReader

                                                                                                  func WithDataFromReader(r io.Reader) Option

                                                                                                    WithDataFromReader loads JSON data from reader

                                                                                                    file, _ := os.Open("data.json")

                                                                                                    func WithDataProvider

                                                                                                    func WithDataProvider(fn DataProviderFunc) Option

                                                                                                      WithDataProvider provides custom data provider

                                                                                                      WithDataProvider(func(*CallData) ([]*dynamic.Message, error) {
                                                                                                      	protoMsg := &helloworld.HelloRequest{Name: "Bob"}
                                                                                                      	dynamicMsg, err := dynamic.AsDynamicMessage(protoMsg)
                                                                                                      	if err != nil {
                                                                                                      		return nil, err
                                                                                                      	return []*dynamic.Message{dynamicMsg}, nil

                                                                                                      func WithDialTimeout

                                                                                                      func WithDialTimeout(dt time.Duration) Option

                                                                                                        WithDialTimeout specifies the initial connection dial timeout


                                                                                                        func WithDurationStopAction

                                                                                                        func WithDurationStopAction(action string) Option

                                                                                                          WithDurationStopAction specifies how run duration (Z) timeout is handled Possible options are "close", "ignore", and "wait"


                                                                                                          func WithEnableCompression

                                                                                                          func WithEnableCompression(enableCompression bool) Option

                                                                                                            WithEnableCompression specifies that requests should be done using gzip Compressor


                                                                                                            func WithInsecure

                                                                                                            func WithInsecure(insec bool) Option

                                                                                                              WithInsecure specifies that this run should be done using insecure mode


                                                                                                              func WithKeepalive

                                                                                                              func WithKeepalive(k time.Duration) Option

                                                                                                                WithKeepalive specifies the keepalive timeout


                                                                                                                func WithLoadDuration

                                                                                                                func WithLoadDuration(duration time.Duration) Option

                                                                                                                  WithLoadDuration specifies the load duration

                                                                                                                  func WithLoadEnd

                                                                                                                  func WithLoadEnd(end uint) Option

                                                                                                                    WithLoadEnd specifies the load end


                                                                                                                    func WithLoadSchedule

                                                                                                                    func WithLoadSchedule(schedule string) Option

                                                                                                                      WithLoadSchedule specifies the load schedule


                                                                                                                      func WithLoadStart

                                                                                                                      func WithLoadStart(start uint) Option

                                                                                                                        WithLoadStart specifies the load start


                                                                                                                        func WithLoadStep

                                                                                                                        func WithLoadStep(step int) Option

                                                                                                                          WithLoadStep specifies the load step


                                                                                                                          func WithLoadStepDuration

                                                                                                                          func WithLoadStepDuration(duration time.Duration) Option

                                                                                                                            WithLoadStepDuration specifies the load step duration for step schedule

                                                                                                                            func WithLogger

                                                                                                                            func WithLogger(log Logger) Option

                                                                                                                              WithLogger specifies the logging option

                                                                                                                              func WithMetadata

                                                                                                                              func WithMetadata(md map[string]string) Option

                                                                                                                                WithMetadata specifies the metadata to be used as a map

                                                                                                                                md := make(map[string]string)
                                                                                                                                md["token"] = "foobar"
                                                                                                                                md["request-id"] = "123"

                                                                                                                                func WithMetadataFromFile

                                                                                                                                func WithMetadataFromFile(path string) Option

                                                                                                                                  WithMetadataFromFile loads JSON metadata from file


                                                                                                                                  func WithMetadataFromJSON

                                                                                                                                  func WithMetadataFromJSON(md string) Option

                                                                                                                                    WithMetadataFromJSON specifies the metadata to be read from JSON string


                                                                                                                                    func WithMetadataProvider

                                                                                                                                    func WithMetadataProvider(fn MetadataProviderFunc) Option

                                                                                                                                      WithMetadataProvider provides custom metadata provider

                                                                                                                                      WithMetadataProvider(ctd *CallData) (*metadata.MD, error) {
                                                                                                                                      	return &metadata.MD{"token": []string{"secret"}}, nil

                                                                                                                                      func WithName

                                                                                                                                      func WithName(name string) Option

                                                                                                                                        WithName sets the name of the test run

                                                                                                                                        WithName("greeter service test")

                                                                                                                                        func WithPacer

                                                                                                                                        func WithPacer(p load.Pacer) Option

                                                                                                                                          WithPacer specified the custom pacer to use

                                                                                                                                          func WithProtoFile

                                                                                                                                          func WithProtoFile(proto string, importPaths []string) Option

                                                                                                                                            WithProtoFile specified proto file path and optionally import paths We will automatically add the proto file path's directory and the current directory

                                                                                                                                            WithProtoFile("greeter.proto", []string{"/home/protos"})

                                                                                                                                            func WithProtoset

                                                                                                                                            func WithProtoset(protoset string) Option

                                                                                                                                              WithProtoset specified protoset file path


                                                                                                                                              func WithRPS

                                                                                                                                              func WithRPS(v uint) Option

                                                                                                                                                WithRPS specifies the RPS (requests per second) limit option


                                                                                                                                                func WithReflectionMetadata

                                                                                                                                                func WithReflectionMetadata(md map[string]string) Option

                                                                                                                                                  WithReflectionMetadata specifies the metadata to be used as a map

                                                                                                                                                  md := make(map[string]string)
                                                                                                                                                  md["token"] = "foobar"
                                                                                                                                                  md["request-id"] = "123"

                                                                                                                                                  func WithRootCertificate

                                                                                                                                                  func WithRootCertificate(cert string) Option

                                                                                                                                                    WithRootCertificate specifies the root certificate options for the run


                                                                                                                                                    func WithRunDuration

                                                                                                                                                    func WithRunDuration(z time.Duration) Option

                                                                                                                                                      WithRunDuration specifies the Z (total test duration) option


                                                                                                                                                      func WithServerNameOverride

                                                                                                                                                      func WithServerNameOverride(cname string) Option

                                                                                                                                                        WithServerNameOverride specifies the certificate options for the run

                                                                                                                                                        func WithSkipFirst

                                                                                                                                                        func WithSkipFirst(c uint) Option

                                                                                                                                                          WithSkipFirst is the skipFirst option

                                                                                                                                                          func WithSkipTLSVerify

                                                                                                                                                          func WithSkipTLSVerify(skip bool) Option

                                                                                                                                                            WithSkipTLSVerify skip client side TLS verification of server certificate

                                                                                                                                                            func WithStreamCallCount

                                                                                                                                                            func WithStreamCallCount(c uint) Option

                                                                                                                                                              WithStreamCallCount sets the stream close count

                                                                                                                                                              func WithStreamCallDuration

                                                                                                                                                              func WithStreamCallDuration(d time.Duration) Option

                                                                                                                                                                WithStreamCallDuration sets the maximum stream call duration at which point the client will close the stream

                                                                                                                                                                func WithStreamDynamicMessages

                                                                                                                                                                func WithStreamDynamicMessages(v bool) Option

                                                                                                                                                                  WithStreamDynamicMessages sets the stream dynamic message generation

                                                                                                                                                                  func WithStreamInterval

                                                                                                                                                                  func WithStreamInterval(d time.Duration) Option

                                                                                                                                                                    WithStreamInterval sets the stream interval

                                                                                                                                                                    func WithStreamMessageProvider

                                                                                                                                                                    func WithStreamMessageProvider(fn StreamMessageProviderFunc) Option

                                                                                                                                                                      WithStreamMessageProvider sets custom stream message provider

                                                                                                                                                                      WithStreamMessageProvider(func(cd *CallData) (*dynamic.Message, error) {
                                                                                                                                                                      	protoMsg := &helloworld.HelloRequest{Name: cd.WorkerID + ": " + strconv.FormatInt(cd.RequestNumber, 10)}
                                                                                                                                                                      	dynamicMsg, err := dynamic.AsDynamicMessage(protoMsg)
                                                                                                                                                                      	if err != nil {
                                                                                                                                                                      		return nil, err
                                                                                                                                                                      	if callCounter == 5 {
                                                                                                                                                                      		err = ErrLastMessage
                                                                                                                                                                      	return dynamicMsg, err

                                                                                                                                                                      func WithStreamRecvMsgIntercept

                                                                                                                                                                      func WithStreamRecvMsgIntercept(fn StreamRecvMsgInterceptFunc) Option

                                                                                                                                                                        WithStreamRecvMsgIntercept specified the stream receive intercept function

                                                                                                                                                                        WithStreamRecvMsgIntercept(func(msg *dynamic.Message, err error) error {
                                                                                                                                                                        	if err == nil && msg != nil {
                                                                                                                                                                        		reply := &helloworld.HelloReply{}
                                                                                                                                                                        		convertErr := msg.ConvertTo(reply)
                                                                                                                                                                        		if convertErr == nil {
                                                                                                                                                                        			if reply.GetMessage() == "Hello bar" {
                                                                                                                                                                        				return ErrEndStream
                                                                                                                                                                        	return nil

                                                                                                                                                                        func WithTags

                                                                                                                                                                        func WithTags(tags map[string]string) Option

                                                                                                                                                                          WithTags specifies the user defined tags as a map

                                                                                                                                                                          tags := make(map[string]string)
                                                                                                                                                                          tags["env"] = "staging"
                                                                                                                                                                          tags["created by"] = "joe developer"

                                                                                                                                                                          func WithTemplateFuncs

                                                                                                                                                                          func WithTemplateFuncs(funcMap template.FuncMap) Option

                                                                                                                                                                            WithTemplateFuncs adds additional template functions

                                                                                                                                                                            func WithTimeout

                                                                                                                                                                            func WithTimeout(timeout time.Duration) Option

                                                                                                                                                                              WithTimeout specifies the timeout for each request


                                                                                                                                                                              func WithTotalRequests

                                                                                                                                                                              func WithTotalRequests(n uint) Option

                                                                                                                                                                                WithTotalRequests specifies the N (number of total requests) setting


                                                                                                                                                                                func WithWorkerTicker

                                                                                                                                                                                func WithWorkerTicker(ticker load.WorkerTicker) Option

                                                                                                                                                                                  WithWorkerTicker specified the custom worker ticker to use

                                                                                                                                                                                  type Options

                                                                                                                                                                                  type Options struct {
                                                                                                                                                                                  	Call              string   `json:"call,omitempty"`
                                                                                                                                                                                  	Host              string   `json:"host,omitempty"`
                                                                                                                                                                                  	Proto             string   `json:"proto,omitempty"`
                                                                                                                                                                                  	Protoset          string   `json:"protoset,omitempty"`
                                                                                                                                                                                  	ImportPaths       []string `json:"import-paths,omitempty"`
                                                                                                                                                                                  	EnableCompression bool     `json:"enable-compression,omitempty"`
                                                                                                                                                                                  	CACert    string `json:"cacert,omitempty"`
                                                                                                                                                                                  	Cert      string `json:"cert,omitempty"`
                                                                                                                                                                                  	Key       string `json:"key,omitempty"`
                                                                                                                                                                                  	CName     string `json:"cname,omitempty"`
                                                                                                                                                                                  	SkipTLS   bool   `json:"skipTLS,omitempty"`
                                                                                                                                                                                  	Insecure  bool   `json:"insecure"`
                                                                                                                                                                                  	Authority string `json:"authority,omitempty"`
                                                                                                                                                                                  	RPS              uint          `json:"rps,omitempty"`
                                                                                                                                                                                  	LoadSchedule     string        `json:"load-schedule"`
                                                                                                                                                                                  	LoadStart        uint          `json:"load-start"`
                                                                                                                                                                                  	LoadEnd          uint          `json:"load-end"`
                                                                                                                                                                                  	LoadStep         int           `json:"load-step"`
                                                                                                                                                                                  	LoadStepDuration time.Duration `json:"load-step-duration"`
                                                                                                                                                                                  	LoadMaxDuration  time.Duration `json:"load-max-duration"`
                                                                                                                                                                                  	Concurrency   uint          `json:"concurrency,omitempty"`
                                                                                                                                                                                  	CSchedule     string        `json:"concurrency-schedule"`
                                                                                                                                                                                  	CStart        uint          `json:"concurrency-start"`
                                                                                                                                                                                  	CEnd          uint          `json:"concurrency-end"`
                                                                                                                                                                                  	CStep         int           `json:"concurrency-step"`
                                                                                                                                                                                  	CStepDuration time.Duration `json:"concurrency-step-duration"`
                                                                                                                                                                                  	CMaxDuration  time.Duration `json:"concurrency-max-duration"`
                                                                                                                                                                                  	Total uint `json:"total,omitempty"`
                                                                                                                                                                                  	Async bool `json:"async,omitempty"`
                                                                                                                                                                                  	Connections   uint          `json:"connections,omitempty"`
                                                                                                                                                                                  	Duration      time.Duration `json:"duration,omitempty"`
                                                                                                                                                                                  	Timeout       time.Duration `json:"timeout,omitempty"`
                                                                                                                                                                                  	DialTimeout   time.Duration `json:"dial-timeout,omitempty"`
                                                                                                                                                                                  	KeepaliveTime time.Duration `json:"keepalive,omitempty"`
                                                                                                                                                                                  	Data     interface{}        `json:"data,omitempty"`
                                                                                                                                                                                  	Binary   bool               `json:"binary"`
                                                                                                                                                                                  	Metadata *map[string]string `json:"metadata,omitempty"`
                                                                                                                                                                                  	CPUs int    `json:"CPUs"`
                                                                                                                                                                                  	Name string `json:"name,omitempty"`
                                                                                                                                                                                  	SkipFirst   uint `json:"skipFirst,omitempty"`
                                                                                                                                                                                  	CountErrors bool `json:"count-errors,omitempty"`

                                                                                                                                                                                    Options represents the request options TODO fix casing and consistency

                                                                                                                                                                                    type Report

                                                                                                                                                                                    type Report struct {
                                                                                                                                                                                    	Name      string     `json:"name,omitempty"`
                                                                                                                                                                                    	EndReason StopReason `json:"endReason,omitempty"`
                                                                                                                                                                                    	Options Options   `json:"options,omitempty"`
                                                                                                                                                                                    	Date    time.Time `json:"date"`
                                                                                                                                                                                    	Count   uint64        `json:"count"`
                                                                                                                                                                                    	Total   time.Duration `json:"total"`
                                                                                                                                                                                    	Average time.Duration `json:"average"`
                                                                                                                                                                                    	Fastest time.Duration `json:"fastest"`
                                                                                                                                                                                    	Slowest time.Duration `json:"slowest"`
                                                                                                                                                                                    	Rps     float64       `json:"rps"`
                                                                                                                                                                                    	ErrorDist      map[string]int `json:"errorDistribution"`
                                                                                                                                                                                    	StatusCodeDist map[string]int `json:"statusCodeDistribution"`
                                                                                                                                                                                    	LatencyDistribution []LatencyDistribution `json:"latencyDistribution"`
                                                                                                                                                                                    	Histogram           []Bucket              `json:"histogram"`
                                                                                                                                                                                    	Details             []ResultDetail        `json:"details"`
                                                                                                                                                                                    	Tags map[string]string `json:"tags,omitempty"`

                                                                                                                                                                                      Report holds the data for the full test

                                                                                                                                                                                      func Run

                                                                                                                                                                                      func Run(call, host string, options ...Option) (*Report, error)

                                                                                                                                                                                        Run executes the test

                                                                                                                                                                                        report, err := runner.Run(
                                                                                                                                                                                        	WithProtoFile("greeter.proto", []string{}),

                                                                                                                                                                                          ExampleRun demonstrates how to use runner package to perform a gRPC load test programmatically. We use the printer package to print the report in pretty JSON format.


                                                                                                                                                                                          func (Report) MarshalJSON

                                                                                                                                                                                          func (r Report) MarshalJSON() ([]byte, error)

                                                                                                                                                                                            MarshalJSON is custom marshal for report to properly format the date

                                                                                                                                                                                            type Reporter

                                                                                                                                                                                            type Reporter struct {
                                                                                                                                                                                            	// contains filtered or unexported fields

                                                                                                                                                                                              Reporter gathers all the results

                                                                                                                                                                                              func (*Reporter) Finalize

                                                                                                                                                                                              func (r *Reporter) Finalize(stopReason StopReason, total time.Duration) *Report

                                                                                                                                                                                                Finalize all the gathered data into a final report

                                                                                                                                                                                                func (*Reporter) Run

                                                                                                                                                                                                func (r *Reporter) Run()

                                                                                                                                                                                                  Run runs the reporter

                                                                                                                                                                                                  type RequestCounter

                                                                                                                                                                                                  type RequestCounter interface {
                                                                                                                                                                                                  	Get() uint64

                                                                                                                                                                                                    RequestCounter gets the request count

                                                                                                                                                                                                    type Requester

                                                                                                                                                                                                    type Requester struct {
                                                                                                                                                                                                    	// contains filtered or unexported fields

                                                                                                                                                                                                      Requester is used for doing the requests

                                                                                                                                                                                                      func NewRequester

                                                                                                                                                                                                      func NewRequester(c *RunConfig) (*Requester, error)

                                                                                                                                                                                                        NewRequester creates a new requestor from the passed RunConfig

                                                                                                                                                                                                        func (*Requester) Finish

                                                                                                                                                                                                        func (b *Requester) Finish() *Report

                                                                                                                                                                                                          Finish finishes the test run

                                                                                                                                                                                                          func (*Requester) Run

                                                                                                                                                                                                          func (b *Requester) Run() (*Report, error)

                                                                                                                                                                                                            Run makes all the requests and returns a report of results It blocks until all work is done.

                                                                                                                                                                                                            func (*Requester) Stop

                                                                                                                                                                                                            func (b *Requester) Stop(reason StopReason)

                                                                                                                                                                                                              Stop stops the test

                                                                                                                                                                                                              type ResultDetail

                                                                                                                                                                                                              type ResultDetail struct {
                                                                                                                                                                                                              	Timestamp time.Time     `json:"timestamp"`
                                                                                                                                                                                                              	Latency   time.Duration `json:"latency"`
                                                                                                                                                                                                              	Error     string        `json:"error"`
                                                                                                                                                                                                              	Status    string        `json:"status"`

                                                                                                                                                                                                                ResultDetail data for each result

                                                                                                                                                                                                                type RunConfig

                                                                                                                                                                                                                type RunConfig struct {
                                                                                                                                                                                                                	// contains filtered or unexported fields

                                                                                                                                                                                                                  RunConfig represents the request Configs

                                                                                                                                                                                                                  func NewConfig

                                                                                                                                                                                                                  func NewConfig(call, host string, options ...Option) (*RunConfig, error)

                                                                                                                                                                                                                    NewConfig creates a new RunConfig from the options passed

                                                                                                                                                                                                                    type StopReason

                                                                                                                                                                                                                    type StopReason string

                                                                                                                                                                                                                      StopReason is a reason why the run ended

                                                                                                                                                                                                                      func ReasonFromString

                                                                                                                                                                                                                      func ReasonFromString(str string) StopReason

                                                                                                                                                                                                                        ReasonFromString creates a Status from a string

                                                                                                                                                                                                                        func (StopReason) MarshalJSON

                                                                                                                                                                                                                        func (s StopReason) MarshalJSON() ([]byte, error)

                                                                                                                                                                                                                          MarshalJSON formats a Threshold value into a JSON string

                                                                                                                                                                                                                          func (StopReason) String

                                                                                                                                                                                                                          func (s StopReason) String() string

                                                                                                                                                                                                                            String() is the string representation of threshold

                                                                                                                                                                                                                            func (*StopReason) UnmarshalJSON

                                                                                                                                                                                                                            func (s *StopReason) UnmarshalJSON(b []byte) error

                                                                                                                                                                                                                              UnmarshalJSON prases a Threshold value from JSON string

                                                                                                                                                                                                                              type StreamMessageProviderFunc

                                                                                                                                                                                                                              type StreamMessageProviderFunc func(*CallData) (*dynamic.Message, error)

                                                                                                                                                                                                                                StreamMessageProviderFunc is the interface for providing a message for every message send in the course of a streaming call

                                                                                                                                                                                                                                type StreamRecvMsgInterceptFunc

                                                                                                                                                                                                                                type StreamRecvMsgInterceptFunc func(*dynamic.Message, error) error

                                                                                                                                                                                                                                  StreamRecvMsgInterceptFunc is an interface for function invoked when we receive a stream message Clients can return ErrEndStream to end the call early

                                                                                                                                                                                                                                  type TickValue

                                                                                                                                                                                                                                  type TickValue struct {
                                                                                                                                                                                                                                  	// contains filtered or unexported fields

                                                                                                                                                                                                                                    TickValue is the tick value

                                                                                                                                                                                                                                    type Worker

                                                                                                                                                                                                                                    type Worker struct {
                                                                                                                                                                                                                                    	// contains filtered or unexported fields

                                                                                                                                                                                                                                      Worker is used for doing a single stream of requests in parallel

                                                                                                                                                                                                                                      func (*Worker) Stop

                                                                                                                                                                                                                                      func (w *Worker) Stop()

                                                                                                                                                                                                                                        Stop stops the worker. It has to be started with Run() again.