exporters

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

elasticsearch.go implements the ElasticsearchExporter object, which is used to export benchmark results to ElasticSearch.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainExporter

type ChainExporter struct {
	Exporters  []define.Exporterable
	Marshalled [][]byte
}

ChainExporter is used to allow for multiple exporters to function through one Expoerterable interface. It's important to initiate Exporters and marshalled appropriately

func (*ChainExporter) Export

func (ce *ChainExporter) Export(payload []byte) error

Export calls the Export method on each Exporterable the ChainExporter is configured with, using the saved payloads from Marshal. This assumes that the ChainExporter's Marshal method has already been called. Otherwise, an out-of-bound slice error might be raised.

func (*ChainExporter) Healthcheck

func (ce *ChainExporter) Healthcheck() error

Healthcheck calls the Healthcheck method on each Exporterable the ChainExporter is configured with.

func (*ChainExporter) Marshal

func (ce *ChainExporter) Marshal(payload interface{}) ([]byte, error)

Marshal calls the Marshal method on each Exporterable the ChainExporter is configured with. Rather than returning the results of each marshal, they are saved in a slice within the ChainExporter. An empty byte array is returned. The Exporter function will use these results while exporting payloads. This function is ripe for a runtime panic if the `marshalled` field is not preallocated to match the length of the number of configured exporters.

func (*ChainExporter) Setup

func (ce *ChainExporter) Setup(cfg *define.Config) error

Setup calls the Setup method on each Exporterable the ChainExporter is configured with.

func (*ChainExporter) Teardown

func (ce *ChainExporter) Teardown() error

Teardown calls the Teardown method on each Exporterable the ChainExporter is configured with.

type DummyExporter

type DummyExporter struct{}

DummyExporter is an exporter that does nothing and returns no errors. Used as a place-holder when no exporters are configured.

func (*DummyExporter) Export

func (de *DummyExporter) Export(payload []byte) error

Export saves the given document, which will be printed when Teardown is called.

func (*DummyExporter) Healthcheck

func (de *DummyExporter) Healthcheck() error

Healthcheck returns nil, no healthcheck needs to be performed for the json exporter.

func (*DummyExporter) Marshal

func (de *DummyExporter) Marshal(payload interface{}) ([]byte, error)

Marshal turns the given payload into pretty-formatted json.

func (*DummyExporter) Setup

func (de *DummyExporter) Setup(cfg *define.Config) error

Setup creates a new array to hold json documents to-be-printed.

func (*DummyExporter) Teardown

func (de *DummyExporter) Teardown() error

Teardown joins all the given documents to export into an array and prints the result.

type ElasticsearchExporter

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

ElasticsearchExporter is used to export benchmark results into Elasticsearch

func (*ElasticsearchExporter) Export

func (es *ElasticsearchExporter) Export(payload []byte) error

func (*ElasticsearchExporter) Healthcheck

func (es *ElasticsearchExporter) Healthcheck() error

func (*ElasticsearchExporter) Marshal

func (es *ElasticsearchExporter) Marshal(payload interface{}) ([]byte, error)

func (*ElasticsearchExporter) Setup

func (es *ElasticsearchExporter) Setup(cfg *define.Config) error

func (*ElasticsearchExporter) Teardown

func (es *ElasticsearchExporter) Teardown() error

type JsonExporter

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

func (*JsonExporter) Export

func (je *JsonExporter) Export(payload []byte) error

Export saves the given document, which will be printed when Teardown is called.

func (*JsonExporter) Healthcheck

func (je *JsonExporter) Healthcheck() error

Healthcheck returns nil, no healthcheck needs to be performed for the json exporter.

func (*JsonExporter) Marshal

func (je *JsonExporter) Marshal(payload interface{}) ([]byte, error)

Marshal turns the given payload into pretty-formatted json.

func (*JsonExporter) Setup

func (je *JsonExporter) Setup(cfg *define.Config) error

Setup creates a new array to hold json documents to-be-printed.

func (*JsonExporter) Teardown

func (je *JsonExporter) Teardown() error

Teardown joins all the given documents to export into an array and prints the result.

Jump to

Keyboard shortcuts

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