runner

package
v3.3.4 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// BackgroundTask are task that must be run in background
	BackgroundTask = []func() ([]*metrics.Metric, *config.SampleConfig, error){}
	// DisableBackgroundTask disable background task
	DisableBackgroundTask = false
)

Functions

func GetNextBackgroundTask added in v3.3.0

func GetNextBackgroundTask() func() ([]*metrics.Metric, *config.SampleConfig, error)

GetNextBackgroundTask return the next background task

func RegisterBackgroundTask added in v3.3.0

func RegisterBackgroundTask(f func() ([]*metrics.Metric, *config.SampleConfig, error))

RegisterBackgroundTask register a background task

func RestoreOriginParamsMetrics

func RestoreOriginParamsMetrics(metrics []*metrics.Metric, params map[string]string) []*metrics.Metric

RestoreOriginParamsMetrics replaces the parameters in the metrics.

func RunWithVariables

func RunWithVariables(ctx context.Context, variables map[string]string, stepsgen map[string]any, sample *config.SampleConfig) ([]*metrics.Metric, error)

RunWithVariables runs the step with variables.

Types

type RunnerResult

type RunnerResult struct {
	Metrics []*metrics.Metric
	Error   error
}

RunnerResult represents the result of a runner.

func RunSample

func RunSample(ctx context.Context, sample *config.SampleConfig) *RunnerResult

RunSample runs a sample.

type StepParamTemplate

type StepParamTemplate struct {
	Env       map[string]string
	Date      time.Time
	Context   context.Context
	Variables map[string]string
}

StepParamTemplate represents a step parameter template.

func (*StepParamTemplate) GetContext

func (s *StepParamTemplate) GetContext(key string) string

GetContext return context value by key

func (*StepParamTemplate) Replace

func (s *StepParamTemplate) Replace(m map[string]string) (map[string]string, error)

Replace replaces the template.

Jump to

Keyboard shortcuts

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