v1.0.4 Latest Latest

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

Go to latest
Published: Apr 30, 2022 License: MIT Imports: 11 Imported by: 1



Package checks implements gobenchdata checks and checks configuration



This section is empty.


This section is empty.


func GenerateConfig

func GenerateConfig(path string) error

GenerateConfig outputs configuration in the provided directory


type Check

type Check struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description"`

	// regex matchers
	Package    string   `yaml:"package"`
	Benchmarks []string `yaml:"benchmarks"`

	// Diff functions are written as `antonmedv/expr` expressions:
	// Two parameters are provided:
	// * `base`: bench.Benchmark
	// * `current`: bench.Benchmark
	// Return a flaot64-castable value. This is then checked against your defined Thresholds
	// In general, calibrate your diff to return:
	// * negative value for improvement
	// * positive value for regression
	DiffFunc   string     `yaml:"diff"`
	Thresholds Thresholds `yaml:"thresholds"`

Check describes a set of benchmarks to run a diff on and check against thresholds

type CheckResult

type CheckResult struct {
	Status Status

	Diffs      []DiffResult
	Thresholds Thresholds

CheckResult reports the output of a Check

type Config

type Config struct {
	Checks []Check `yaml:"checks"`

Config declares checks configurations

func LoadConfig

func LoadConfig(path string) (*Config, error)

LoadConfig reads configuration from the given path

type DiffResult

type DiffResult struct {
	Status Status

	Package   string
	Benchmark string

	Value float64

DiffResult is the result of a diff

type EnvDiffFunc

type EnvDiffFunc struct {
	Check *Check
	// contains filtered or unexported fields

EnvDiffFunc describes variables provided to a DiffFunc

type EvaluateOptions

type EvaluateOptions struct {
	// MustFindAll enforces that all checks must exist in both base and current.
	MustFindAll bool
	// Debug enables debug output.
	Debug bool

EvaluateOptions declares options for checks evaluation

type Report

type Report struct {
	Status Status

	Base    string
	Current string

	Checks map[string]*CheckResult

Report reports the output of Evaluate

func Evaluate

func Evaluate(checks []Check, base bench.RunHistory, current bench.RunHistory, opts *EvaluateOptions) (*Report, error)

Evaluate checks against benchmark runs

func LoadReport

func LoadReport(path string) (*Report, error)

LoadReport loads checks results from the given path

type Status

type Status string

Status describes result of a check

const (
	// StatusPass is good!
	StatusPass Status = "pass"
	// StatusFail is bad
	StatusFail Status = "fail"
	// StatusNotFound means no measurements were found
	StatusNotFound Status = "not-found"

type Thresholds

type Thresholds struct {
	Min *float64 `yaml:"min,omitempty"`
	Max *float64 `yaml:"max,omitempty"`

Thresholds declares values from ChangeFunc to fail

Jump to

Keyboard shortcuts

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