Documentation
¶
Overview ¶
benchmark.go defines items relevent to the execution of benchmarks and the parsing of their output
config.go provides items which help define the current runtime configuration.
export.go defines items relevant to the export of benchmark data.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Benchmarkable ¶
type Benchmarkable interface { // Setup runs tasks which need to be done prior to calling Run. // These tasks could involve verifying integrity of config files or // creating needed objects. Setup(*Config) error // Run actually runs the benchmark and sends the benchmark's result // data to the Exporter. Assume benchmark passes if error is nil. Run(Exporterable) error // Teardown does any finishing tasks after the benchmark has ran and // exported its results. Teardown(*Config) error }
Benchmarkable defines methods gobench needs to run a benchmark.
type Config ¶
type Config struct { Verbose bool Quiet bool RunID string PrintJson bool ElasticsearchURL string ElasticsearchIndex string ElasticsearchSkipVerify bool ElasticsearchInjectProductHeader bool }
Config defines common runtime objects which need to be accessed by other objects within gobench. It uses a singleton pattern. Reference: https://refactoring.guru/design-patterns/singleton/go/example
type Exporterable ¶
type Exporterable interface { // Setup takes current Config and gets the Exporter ready to export data. // As an example, this could create a goroutine and some channels to // perform async export in the background. Setup(*Config) error // Teardown closes the Exporter down. Teardown() error // Healthcheck ensures that the exporter is ready to function. Healthcheck() error // Marshal prepares the given object to be exported by marshaling it into // a byte string. Marshal(interface{}) ([]byte, error) // Export takes the given byte string (assumed to be marshaled) and exports // it. Differenc exporters can choose whether to make this async or sync. Export([]byte) error }
Exporterable defines methods needed by concrete Exporter objects. It is assumed that Exporterable objects are created with the intention of being added into the current runtime's Config.
type Metadata ¶
Metadata is a struct intended to be used by benchmarks to apply common metadata options to their payloads.
func GetMetadataPayload ¶
GetMetadataPayload constructs a new Metadata struct from the given Config instance.