borda

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: 8 Imported by: 0

README

Borda

wercker status

Borda, named after Jean-Charles de Borda, is a collection point for metrics from Lantern clients and servers.

REST API

REST API Docs

Documentation

Index

Constants

View Source
const (
	// ContentType is the key for the Content-Type header
	ContentType = "Content-Type"

	// ContentTypeJSON is the allowed content type
	ContentTypeJSON = "application/json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector interface {
	http.Handler

	// Submit submits a measurement to the Collector
	Submit(*Measurement)

	// Wait waits up to timeout for the Collector to finish running and returns
	// the error that caused the Collector to terminate. A timeout of -1 causes
	// Wait to block indefinitely.
	Wait(timeout time.Duration) error
}

Collector collects Measurements

func NewCollector

func NewCollector(opts *Options) Collector

NewCollector creates and starts a new Collector

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 map[string]interface{} `json:"dimensions,omitempty"`
}

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

type Options

type Options struct {
	// IndexedDimensions identifies which dimensions should be indexed for fast
	// queries and grouping. In InfluxDB these are stored as "tags".
	IndexedDimensions []string

	// WriteToDatabase is a function that writes a batch to the database. If
	// specified, the influx connection parameters are ignored
	WriteToDatabase WriteFunc

	// DBName identifies the name of the InfluxDB database
	DBName string

	// BatchSize is the number of measurements to include in a batch before
	// writing it. If BatchSize is not specified, it defaults to 1000.
	BatchSize int

	// MaxBatchWindow is the maximum amount of time to wait before writing a
	// batch of measurements. If MaxBatchWindow is reached before BatchSize, the
	// Collector will write the batch of Measurements anyway. If MaxBatchWindow is
	// unspecified, this feature is not used.
	MaxBatchWindow time.Duration

	// MaxRetries caps the number of times that we retry a batch. Defaults to 10.
	MaxRetries int

	// RetryInterval specifies the amount of time to wait before retrying a batch.
	// Defaults to 5 seconds.
	RetryInterval time.Duration
}

Options configures a Collector.

type WriteFunc

type WriteFunc func(client.BatchPoints) error

WriteFunc is a function that writes a batch to the database

func InfluxWriter

func InfluxWriter(
	influxURL string,
	user string,
	pass string,
) (WriteFunc, error)

InfluxWriter creates a WriteFunc that writes to InfluxDB

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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