loadtester

package module
v0.0.0-...-d725791 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

README

LoadTester Trigger

This trigger provides your flogo application the ability to run simple load test on a specified action

Implementation based off go-wrk.

Installation

flogo install github.com/project-flogo/contrib/trigger/loadtester

Configuration

Settings:
Name Type Description
startDelay int The start delay of the test in seconds, default: 30
duration int The duration of the test in seconds, default: 60
concurrency int The level of concurrency, default: 5
data any Optional data to pass along to the action
handler string The named handler to test, defaults to the first handler
Output:
Name Type Description
data any The data from the settings to pass along

Example Configuration

Test Flow

Configure the Trigger to load test the 'flow:testflow'

{
  "triggers": [
    {
      "id": "tester",
      "ref": "github.com/project-flogo/contrib/trigger/loadtester",
      "settings": {
        "startDelay": 15,
        "duration": 120,
        "concurrency" : 5,
        "handler": "test"
      },
      "handlers": [
        {
          "name": "test",
          "action": {
            "ref": "github.com/project-flogo/flow",
            "settings": {
                "flowURI": "res://flow:testflow"
            }       
          }
        }
      ]
    }
  ]
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MaxDuration

func MaxDuration(d1 time.Duration, d2 time.Duration) time.Duration

func MinDuration

func MinDuration(d1 time.Duration, d2 time.Duration) time.Duration

Types

type Factory

type Factory struct {
}

func (*Factory) Metadata

func (*Factory) Metadata() *trigger.Metadata

Metadata implements trigger.Factory.Metadata

func (*Factory) New

func (*Factory) New(config *trigger.Config) (trigger.Trigger, error)

New implements trigger.Factory.New

type LoadSession

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

func NewLoadSession

func NewLoadSession(duration int, statsAggregator chan *RequesterStats) *LoadSession

func (*LoadSession) Run

func (lt *LoadSession) Run(handler trigger.Handler, data interface{})

func (*LoadSession) Stop

func (lt *LoadSession) Stop()

type LoadTest

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

func NewLoadTest

func NewLoadTest(duration, concurrencyLevel int) *LoadTest

func (*LoadTest) Run

func (lt *LoadTest) Run(handler trigger.Handler, data interface{}) error

type Output

type Output struct {
	Data interface{} `md:"data"` // The data from the settings to pass along
}

func (*Output) FromMap

func (o *Output) FromMap(values map[string]interface{}) error

func (*Output) ToMap

func (o *Output) ToMap() map[string]interface{}

type RequesterStats

type RequesterStats struct {
	TotDuration    time.Duration
	MinRequestTime time.Duration
	MaxRequestTime time.Duration
	NumRequests    int
	NumErrs        int
}

RequesterStats used for collection aggregate statistics

type Settings

type Settings struct {
	Concurrency int         `md:"concurrency"` // The level of concurrency, default: 5
	Duration    int         `md:"duration"`    // The duration of the test in seconds, default: 60
	Data        interface{} `md:"data"`        // Optional data to pass along to the action
	Handler     string      `md:"handler"`     // The named handler to test, defaults to the first handler
	StartDelay  int         `md:"startDelay"`  // The start delay of the test in seconds, default: 30
}

type Trigger

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

func (*Trigger) Initialize

func (t *Trigger) Initialize(ctx trigger.InitContext) error

func (*Trigger) Start

func (t *Trigger) Start() error

Stop implements util.Managed.Start

func (*Trigger) Stop

func (t *Trigger) Stop() error

Stop implements util.Managed.Stop

Jump to

Keyboard shortcuts

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