api

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BenchmarkSpec

type BenchmarkSpec struct {
	Scenarios  []*ScenarioSpec `json:"scenarios" yaml:"scenarios" validate:"required,min=1,dive"`
	Executions int             `validate:"required,gte=1"`
	Alternate  bool            `json:"alternate,omitempty" yaml:"alternate,omitempty"`
}

BenchmarkSpec benchmark specs top level structure

type CommandExecutor

type CommandExecutor interface {
	Execute(cmd *CommandSpec, defaultWorkingDir string, env map[string]string) error
}

CommandExecutor is an abstraction for commands executed as subprocesses.

type CommandSpec

type CommandSpec struct {
	WorkingDirectory string   `json:"workingDir,omitempty" yaml:"workingDir,omitempty"`
	Cmd              []string `json:"cmd" yaml:"cmd" validate:"required"`
}

CommandSpec benchmark command execution specs

type End

type End = func(error)

End ends a trace

type ExecutionContext

type ExecutionContext struct {
	Executor CommandExecutor
	Tracer   Tracer
}

ExecutionContext provides access to benchmark global resources

func NewExecutionContext

func NewExecutionContext(tracer Tracer, executor CommandExecutor) *ExecutionContext

NewExecutionContext creates a new ExecutionContext.

type ID

type ID = string

ID ...

type Identifiable

type Identifiable interface {
	ID() ID
}

Identifiable an abstraction for identifiable objects

type ReportContext added in v0.0.8

type ReportContext struct {
	Labels         []string
	IncludeHeaders bool
}

ReportContext contextual information to propagate to report handlers

type ReportHandler added in v1.1.0

type ReportHandler interface {
	Subscribe(TraceStream)
	Finalize() error
}

ReportHandler an async handler

type ScenarioSpec

type ScenarioSpec struct {
	Name             string            `json:"name" yaml:"name" validate:"required"`
	WorkingDirectory string            `json:"workingDir,omitempty" yaml:"workingDir,omitempty"`
	Env              map[string]string `json:"env,omitempty" yaml:"env,omitempty"`
	BeforeAll        *CommandSpec      `json:"beforeAll,omitempty" yaml:"beforeAll,omitempty"`
	AfterAll         *CommandSpec      `json:"afterAll,omitempty" yaml:"afterAll,omitempty"`
	BeforeEach       *CommandSpec      `json:"beforeEach,omitempty" yaml:"beforeEach,omitempty"`
	AfterEach        *CommandSpec      `json:"afterEach,omitempty" yaml:"afterEach,omitempty"`
	Command          *CommandSpec      `validate:"required,dive"`
}

ScenarioSpec benchmark scenario specs

func (*ScenarioSpec) ID

func (s *ScenarioSpec) ID() string

ID returns a unique identifier

type Stats

type Stats interface {
	Min() (float64, error)
	Max() (float64, error)
	Mean() (float64, error)
	Median() (float64, error)
	Percentile(percent float64) (float64, error)
	StdDev() (float64, error)
	ErrorRate() float64
	Count() int
}

Stats provides access to statistics. Statistics are not necessarily cached and might be calculated on call.

type Summary

type Summary interface {
	Get(ID) Stats
	All() map[ID]Stats
	Time() time.Time
}

Summary provides access a cpollection of identifiable statistics.

type Trace

type Trace interface {
	ID() string
	Elapsed() time.Duration
	Error() error
}

Trace a single time trace

type TraceStream added in v1.1.0

type TraceStream = chan Trace

TraceStream ...

type Tracer

type Tracer interface {
	Start(i Identifiable) End
	Stream() TraceStream
}

Tracer a global tracing handler that accumulates trace data and provides access to it.

type WriteSummaryReportFn added in v1.1.0

type WriteSummaryReportFn = func(Summary, *BenchmarkSpec, *ReportContext) error

WriteSummaryReportFn a benchmark report handler

Jump to

Keyboard shortcuts

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