model

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Float

func Float(min, max float64) float64

func Int

func Int(min, max int) int

func Interval

func Interval(min, max time.Duration) time.Duration

func Timestamp

func Timestamp(min, max time.Time) time.Time

Types

type Arg

type Arg struct {
	Type string `yaml:"type"`
	// contains filtered or unexported fields
}

func (*Arg) UnmarshalYAML

func (a *Arg) UnmarshalYAML(unmarshal func(any) error) error

type Drk

type Drk struct {
	GlobalArgs  map[string]Arg        `yaml:"args"`
	EnvMappings map[string]EnvMapping `yaml:"arg_mappings"`
	Workflows   map[string]Workflow   `yaml:"workflows"`
	Activities  map[string]Query      `yaml:"activities"`
}

type EnvMapping added in v0.4.0

type EnvMapping map[string]string

type EnvironmentVariables added in v0.14.0

type EnvironmentVariables struct {
	Config            string        `env:"CONFIG,required"`
	URL               string        `env:"URL,required"`
	Driver            string        `env:"DRIVER"`
	Duration          time.Duration `env:"DURATION"`
	Retries           int           `env:"RETRIES"`
	QueryTimeout      time.Duration `env:"QUERY_TIMEOUT"`
	Debug             bool          `env:"DEBUG"`
	AverageWindowSize int           `env:"AVERAGE_WINDOW_SIZE"`
}

EnvironmentVariables are set by the caller and change how drk behaves.

type Event

type Event struct {
	Workflow string
	Name     string
	Duration time.Duration
	Err      error
}

Event is published whenever an operation of type Name is performed.

type FieldMissingErr

type FieldMissingErr struct {
	Name string
}

FieldMissingErr is returned when a fields isn't found in the config file.

func (FieldMissingErr) Error

func (err FieldMissingErr) Error() string

type Query

type Query struct {
	Type  string `yaml:"type"`
	Args  []Arg  `yaml:"args"`
	Query string `yaml:"query"`
}

type Rate

type Rate struct {
	Times    int
	Interval time.Duration
	// contains filtered or unexported fields
}

func (Rate) String

func (r Rate) String() string

func (*Rate) UnmarshalYAML

func (r *Rate) UnmarshalYAML(node *yaml.Node) error

type Runner

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

func NewRunner

func NewRunner(cfg *Drk, db repo.Queryer, e EnvironmentVariables, logger *zerolog.Logger) (*Runner, error)

func (*Runner) GetEventStream

func (r *Runner) GetEventStream() <-chan Event

func (*Runner) Run

func (r *Runner) Run() error

type VU

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

func NewVU

func NewVU(r *Runner) *VU

type Workflow

type Workflow struct {
	Vus          int             `yaml:"vus"`
	SetupQueries []string        `yaml:"setup_queries"`
	Queries      []WorkflowQuery `yaml:"queries"`
	RunAfter     time.Duration   `yaml:"run_after"`
	RunFor       time.Duration   `yaml:"run_for"`
	RampFor      time.Duration   `yaml:"ramp_for"`
}

type WorkflowQuery

type WorkflowQuery struct {
	Name string `yaml:"name"`
	Rate Rate   `yaml:"rate"`
}

Jump to

Keyboard shortcuts

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