models

package
v2.8.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IScenario

type IScenario interface {
	StartPrimitives()
	Init()
	Close()
	RunStep(context.Context, string, map[string]string, time.Duration, bool) ([]Metric, error)
	RegisterStep(string, StepDefinition)
	Description() string
	GetScenarioDefinitions() map[string]StepDefinition
}

IScenario Define scenario interface

type Metric

type Metric struct {
	ID             uuid.UUID `gorm:"primaryKey;type:char(36);"`
	Name           string
	Value          float64
	Labels         map[string]string `gorm:"-"`
	Description    string
	SampleID       string
	Expires        time.Duration
	SampleResultID uuid.UUID `json:"-"`
}

Metric definition

type MetricLabel

type MetricLabel struct {
	Key      string
	Value    string
	Metric   Metric `gorm:"foreignKey:MetricID" json:"-"`
	MetricID string
}

MetricLabel definition

type Sample

type Sample struct {
	Name           string
	Description    string
	Tags           map[string]string
	Scenario       Scenario
	ScrapeInterval time.Duration `yaml:"scrapeInterval"`
}

Sample represent sample scenarios

func ReadSampleYAML

func ReadSampleYAML(data []byte) (*Sample, error)

ReadSampleYAML Read scenarios pointer from yaml

type Scenario

type Scenario struct {
	Kind             string
	Steps            []Step
	StepsDefinitions map[string]StepDefinition
	Context          context.Context
}

Scenario definition

func (*Scenario) Description

func (s *Scenario) Description() string

Description Get scenario description

func (*Scenario) GetScenarioDefinitions

func (s *Scenario) GetScenarioDefinitions() map[string]StepDefinition

GetScenarioDefinitions Get scenario definitions

func (*Scenario) RegisterStep

func (s *Scenario) RegisterStep(name string, step StepDefinition)

RegisterStep Register step default method

func (*Scenario) RunStep

func (s *Scenario) RunStep(ctx context.Context, name string, p map[string]string, timeout time.Duration, negate bool) ([]Metric, error)

RunStep Run an step

func (*Scenario) StartPrimitives

func (s *Scenario) StartPrimitives()

StartPrimitives Initialize primitive variables

type ScenarioResult

type ScenarioResult struct {
	Scenario    Scenario
	StartDate   time.Time
	EndDate     time.Time
	StepResults []*StepResult
	Error       error `json:"-"`
	ErrorString string
}

ScenarioResult is the result of a scenario

type Step

type Step struct {
	Type    string
	Params  map[string]string
	Negate  bool
	Timeout time.Duration
}

Step definition

type StepDefinition

type StepDefinition struct {
	Name        string
	Description string
	Params      []StepParam
	Fn          stepFn `json:"-"`
}

StepDefinition definition

type StepParam

type StepParam struct {
	Name        string
	Description string
	Optional    bool
}

StepParam returns the value of a step parameter

type StepResult

type StepResult struct {
	Step      Step
	StartDate time.Time
	EndDate   time.Time
	Metrics   []Metric
}

StepResult is the result of a step

Jump to

Keyboard shortcuts

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