client

package
v0.0.0-...-8b1022e Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2016 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a client that submits measurements to the borda server.

func NewClient

func NewClient(opts *Options) *Client

NewClient creates a new borda client.

func (*Client) Flush

func (c *Client) Flush()

Flush flushes any currently buffered data.

func (*Client) ReducingSubmitter

func (c *Client) ReducingSubmitter(name string, maxBufferSize int, reduce Reducer) Submitter

ReducingSubmitter returns a Submitter whose measurements are reduced using the specified Reducer. name specifies the name of the measurements and maxBufferSize specifies the maximum number of distinct measurements to buffer within the BatchInterval. Anything past this is discarded.

type Measurement

type Measurement struct {
	// Name is the name of the measurement (e.g. cpu_usage). It maps to the "key"
	// in "InfluxDB".
	Name string `json:"name"`

	// Ts records the time of the measurement.
	Ts time.Time `json:"ts,omitempty"`

	// Values contains numeric values of the measurement. These will be stored as
	// "fields" in InfluxDB.
	//
	// Example: { "num_errors": 67 }
	Values map[string]float64 `json:"values,omitempty"`

	// Dimensions captures key/value pairs which characterize the measurement.
	// Dimensions are stored as "tags" or "fields" in InfluxDB depending on which
	// dimensions have been configured as "IndexedDimensions" on the Collector.
	//
	// Example: { "requestid": "18af517b-004f-486c-9978-6cf60be7f1e9",
	//            "ipv6": "2001:0db8:0a0b:12f0:0000:0000:0000:0001",
	//            "host": "myhost.mydomain.com",
	//            "total_cpus": "2",
	//            "cpu_idle": 10.1,
	//            "cpu_system": 53.3,
	//            "cpu_user": 36.6,
	//            "connected_to_internet": true }
	Dimensions json.RawMessage `json:"dimensions,omitempty"`
}

Measurement represents a measurement at a point in time. It maps to a "point" in InfluxDB.

type Options

type Options struct {
	// BatchInterval specifies how frequent to report to borda
	BatchInterval time.Duration

	// Client used to report to Borda
	Client *http.Client
}

Options provides configuration options for borda clients

type Reducer

type Reducer func(existingValues map[string]float64, newValues map[string]float64)

Reducer is a function that merges the newValues into the existingValues for a given measurement.

type Submitter

type Submitter func(values map[string]float64, dimensions map[string]interface{}) error

Submitter is a functon that submits measurements to borda. If the measurement was successfully queued for submission, this returns nil.

Jump to

Keyboard shortcuts

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