k6runner

package
v0.29.2 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 20 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 ErrNoTimeout = errors.New("check has no timeout")

ErrNoTimeout is returned by Runner implementations if the supplied script has a timeout of zero.

View Source
var ErrUnexpectedStatus = errors.New("unexpected status code")

Functions

This section is empty.

Types

type CheckInfo added in v0.29.0

type CheckInfo struct {
	// Type is the string representation of the check type this script belongs to (browser, scripted, multihttp, etc.)
	Type string `json:"type"`
	// Metadata is a collection of key/value pairs containing information about this check, such as check and tenant ID.
	// It is loosely typed on purpose: Metadata should only be used for informational properties that will make its way
	// into telemetry, and not for making decision on it.
	Metadata map[string]any `json:"metadata"`
}

CheckInfo holds information about the SM check that triggered this script.

func CheckInfoFromSM added in v0.29.0

func CheckInfoFromSM(smc smmmodel.Check) CheckInfo

CheckInfoFromSM returns a CheckInfo from the information of the given SM check.

type HTTPRunRequest added in v0.28.1

type HTTPRunRequest struct {
	Script   `json:",inline"`
	NotAfter time.Time `json:"notAfter"`
}

HTTPRunRequest

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 Local added in v0.28.2

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

func (Local) Run added in v0.28.2

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

func (Local) WithLogger added in v0.28.2

func (r Local) 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 is the blob of bytes that is to be run.
	Script []byte `json:"script"`
	// Settings is a common representation of the fields common to all implementation-specific check settings that the
	// runners are interested about.
	Settings Settings `json:"settings"`
	// CheckInfo holds information about the SM check that triggered this script.
	CheckInfo CheckInfo `json:"check"`
}

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"`
}

Settings is a common representation of the fields common to all implementation-specific check settings that the runners are interested about.

Jump to

Keyboard shortcuts

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