k6runner

package
v0.24.3 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBuggyRunner = errors.New("runner returned buggy response")
	ErrFromRunner  = errors.New("runner reported an error")
)
View Source
var ErrUnexpectedStatus = errors.New("unexpected status code")

Functions

This section is empty.

Types

type HttpRunner

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

func (HttpRunner) Run

func (r HttpRunner) Run(ctx context.Context, script Script) (*RunResponse, error)

func (HttpRunner) WithLogger

func (r HttpRunner) WithLogger(logger *zerolog.Logger) Runner

type LocalRunner

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

func (LocalRunner) Run

func (r LocalRunner) Run(ctx context.Context, script Script) (*RunResponse, error)

func (LocalRunner) WithLogger

func (r LocalRunner) WithLogger(logger *zerolog.Logger) Runner

type Processor added in v0.24.3

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

Processor runs a script with a runner and parses the k6 output.

func NewProcessor added in v0.24.3

func NewProcessor(script Script, k6runner Runner) (*Processor, error)

func (Processor) Run added in v0.24.3

func (r Processor) Run(ctx context.Context, registry *prometheus.Registry, logger logger.Logger, internalLogger zerolog.Logger) (bool, error)

type RunResponse

type RunResponse struct {
	Error     string `json:"error,omitempty"`
	ErrorCode string `json:"errorCode,omitempty"`
	Metrics   []byte `json:"metrics"`
	Logs      []byte `json:"logs"`
}

type Runner

type Runner interface {
	WithLogger(logger *zerolog.Logger) Runner
	Run(ctx context.Context, script Script) (*RunResponse, error)
}

func New

func New(opts RunnerOpts) Runner

type RunnerOpts added in v0.22.0

type RunnerOpts struct {
	Uri           string
	BlacklistedIP string
}

type Script

type Script struct {
	Script   []byte   `json:"script"`
	Settings Settings `json:"settings"`
}

Script is a k6 script that a runner is able to run, with some added instructions for that runner to act on.

type Settings added in v0.19.0

type Settings struct {
	// Timeout for k6 run, in milliseconds. This value is a configuration value for remote runners, which will instruct
	// them to return an error if the operation takes longer than this time to complete. Clients should expect that
	// requests to remote runners may take longer than this value due to network and other latencies, and thus clients
	// should wait additional time before aborting outgoing requests.
	Timeout int64 `json:"timeout"`
}

Jump to

Keyboard shortcuts

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