metrics

package
v0.0.0-...-b149846 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector interface {
	// Forward makes the collector start collecting Harvests. When the Collector receives a Harvest,
	// it forwards it from the channel passed as argument
	Forward(chan<- Harvest)
}

Collector implementors harvest metrics from a given source and forward them by the channel specified in the Forward function

func NewHTTPCollector

func NewHTTPCollector(server transport.HTTPServer) Collector

NewHTTPCollector attaches an httpCollector to the "/http" path of the passed server, and returns it.

func StaticCollector

func StaticCollector(harvesters ...Harvester) Collector

StaticCollector creates a staticCollector from a set of harvesters that are statically available at compile time

type Harvest

type Harvest map[string]interface{}

Harvest represents a key-value map of a collected set of metrics. To ve valid, it must have an "eventType" field.

func (Harvest) EventType

func (p Harvest) EventType(eventType string)

EventType sets the event type of the harvest

func (Harvest) Validate

func (p Harvest) Validate() error

Validate checks that all the required fields are set with valid values

type Harvester

type Harvester interface {
	// Start makes the harvester collecting new metrics. Each individual harvested metric will be
	// submitted through the channel that is passed by argument.
	Start(chan<- Harvest)
}

Harvester defines the interface for any item that collects (harvests) metrics, and submits them through the channel passed in the Start function

func SystemHarvester

func SystemHarvester(interval time.Duration) Harvester

SystemHarvester returns a harvester that collects system-level metrics (cpu, memory consumption...) with the interval passed as parameter

Jump to

Keyboard shortcuts

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