Help us shape the future of Go! Take the 2026 Go Developer Survey

bench

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UserAgent = fmt.Sprintf("Benchtool/%s", version.Version)

Functions

This section is empty.

Types

type Config

type Config struct {
	ID               string `yaml:"id"`
	InstanceName     string `yaml:"instance_name"`
	WorkloadFilePath string `yaml:"workload_file_path"`

	RingCheck RingCheckConfig  `yaml:"ring_check"`
	Write     WriteBenchConfig `yaml:"writes"`
	Query     QueryConfig      `yaml:"query"`
}

func (*Config) RegisterFlags

func (cfg *Config) RegisterFlags(f *flag.FlagSet)

type LabelDesc

type LabelDesc struct {
	Name         string `yaml:"name"`
	ValuePrefix  string `yaml:"value_prefix"`
	UniqueValues int    `yaml:"unique_values"`
}

type QueryConfig

type QueryConfig struct {
	Enabled           bool   `yaml:"enabled"`
	Endpoint          string `yaml:"endpoint"`
	BasicAuthUsername string `yaml:"basic_auth_username"`
	BasicAuthPasword  string `yaml:"basic_auth_password"`
}

func (*QueryConfig) RegisterFlags

func (cfg *QueryConfig) RegisterFlags(f *flag.FlagSet)

type QueryDesc

type QueryDesc struct {
	NumQueries               int           `yaml:"num_queries"`
	ExprTemplate             string        `yaml:"expr_template"`
	RequiredSeriesType       SeriesType    `yaml:"series_type"`
	Interval                 time.Duration `yaml:"interval"`
	TimeRange                time.Duration `yaml:"time_range,omitempty"`
	Regex                    bool          `yaml:"regex"`
	InjectExactSerierMatcher bool          `yaml:"inject_exact_series_matcher"`
}

type RingCheckConfig

type RingCheckConfig struct {
	Enabled       bool                `yaml:"enabled"`
	MemberlistKV  memberlist.KVConfig `yaml:"memberlist"`
	RingConfig    ring.Config         `yaml:"ring"`
	CheckInterval time.Duration       `yaml:"check_interval"`
}

func (*RingCheckConfig) RegisterFlagsWithPrefix

func (cfg *RingCheckConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

type RingChecker

type RingChecker struct {
	Ring         *ring.Ring
	MemberlistKV *memberlist.KVInitService
	// contains filtered or unexported fields
}

func NewRingChecker

func NewRingChecker(id string, instanceName string, cfg RingCheckConfig, workload *WriteWorkload, logger log.Logger) (*RingChecker, error)

func (*RingChecker) Run

func (r *RingChecker) Run(ctx context.Context) error

type Runner

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

func NewBenchRunner

func NewBenchRunner(cfg Config, logger log.Logger, reg prometheus.Registerer) (*Runner, error)

func (*Runner) Run

func (b *Runner) Run(ctx context.Context) error

type SeriesDesc

type SeriesDesc struct {
	Name         string            `yaml:"name"`
	Type         SeriesType        `yaml:"type"`
	StaticLabels map[string]string `yaml:"static_labels"`
	Labels       []LabelDesc       `yaml:"labels"`
}

type SeriesType

type SeriesType string
const (
	GaugeZero     SeriesType = "gauge-zero"
	GaugeRandom   SeriesType = "gauge-random"
	CounterOne    SeriesType = "counter-one"
	CounterRandom SeriesType = "counter-random"
)

type Timeseries

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

func SeriesDescToSeries

func SeriesDescToSeries(seriesDescs []SeriesDesc) ([]*Timeseries, map[SeriesType]int)

type WorkloadDesc

type WorkloadDesc struct {
	Replicas  int          `yaml:"replicas"`
	Series    []SeriesDesc `yaml:"series"`
	QueryDesc []QueryDesc  `yaml:"queries"`
	Write     WriteDesc    `yaml:"write_options"`
}

type WriteBenchConfig

type WriteBenchConfig struct {
	Enabled           bool   `yaml:"enabled"`
	Endpoint          string `yaml:"endpoint"`
	BasicAuthUsername string `yaml:"basic_auth_username"`
	BasicAuthPasword  string `yaml:"basic_auth_password"`
	ProxyURL          string `yaml:"proxy_url"`
}

func (*WriteBenchConfig) RegisterFlags

func (cfg *WriteBenchConfig) RegisterFlags(f *flag.FlagSet)

type WriteBenchmarkRunner

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

func NewWriteBenchmarkRunner

func NewWriteBenchmarkRunner(id string, tenantName string, cfg WriteBenchConfig, workload *WriteWorkload, logger log.Logger, reg prometheus.Registerer) (*WriteBenchmarkRunner, error)

func (*WriteBenchmarkRunner) Run

Run starts a loop that forwards metrics to the configured remote write endpoint

type WriteDesc

type WriteDesc struct {
	Interval  time.Duration `yaml:"interval"`
	Timeout   time.Duration `yaml:"timeout"`
	BatchSize int           `yaml:"batch_size"`
}

type WriteWorkload

type WriteWorkload struct {
	Replicas           int
	Series             []*Timeseries
	TotalSeries        int
	TotalSeriesTypeMap map[SeriesType]int
	// contains filtered or unexported fields
}

func (*WriteWorkload) GenerateTimeSeries

func (w *WriteWorkload) GenerateTimeSeries(id string, t time.Time) []prompb.TimeSeries

Jump to

Keyboard shortcuts

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