partition

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PartitionStats

type PartitionStats struct {
	Partition  string
	Throughput float64
	Successes  float64
	Errors     float64

	NormalizedThroughput float64
	Score                int
}

type Stats

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

Stats keeps track of throughput and error rates for each partition

func NewStats

func NewStats() *Stats

NewStats returns a new, initialised partition stats

func (*Stats) All

func (s *Stats) All() map[string]PartitionStats

All returns a map containing stats for all available partitions

func (*Stats) Score

func (s *Stats) Score(partition string) int

Score returns a score for the given partition. The score is a number between 0 and 100. Scores are calculated comparatively to other partitions, so that the partition with the highest throughput and the lowest error ratio will receive the highest score.

func (*Stats) Update

func (s *Stats) Update(partition string, duration time.Duration, total, errors int)

Update updates the stats for the given partition in terms of throughput, total requests and errors

Jump to

Keyboard shortcuts

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