collector

package
v0.0.0-...-f4ec7ef Latest Latest
Warning

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

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

Documentation

Overview

Package collector contains the actual fullerite collectors (and the corresponding tests). All collectors need to embed baseCollector. Look at one of the existing collectors (test.go) to see how this is done.

mesos collector (mesos.go): This collector runs on all mesos masters. It identifies the leader amongst masters and collects stats from this leader only. Mesos masters report stats on :5050/metrics/snapshot, which is JSON. All these stats are pushed via fullerite to the configured handlers. Some sanitization is performed to convert the names to a more metric-y style. For example, "masters/cpus" would be changed to "masters.cpu."

Index

Constants

View Source
const (
	//DefaultOpenTSDBCollectorPort is the TCP port that OpenTSDB clients will push data to
	DefaultOpenTSDBCollectorPort = "4242"
	// MetricRegex provides the default OpenTSDB regex
	MetricRegex = `put (?P<name>[0-9\.\-\_a-zA-Z]+)\s+(?P<dimensions>[0-9\.\-\_\=\,a-zA-Z]+)\s+(?P<time>\d+)\s+(?P<value>[0-9\.]+)`
)
View Source
const (
	// DefaultCollectionInterval the interval to collect on unless overridden by a collectors config
	DefaultCollectionInterval = 10
)
View Source
const (
	// DefaultDiamondCollectorPort is the TCP port that diamond
	// collectors write to and we read off of.
	DefaultDiamondCollectorPort = "19191"
)

Variables

This section is empty.

Functions

func RegisterCollector

func RegisterCollector(name string, f func(chan metric.Metric, int, *l.Entry) Collector)

RegisterCollector composes a map of collector names -> factor functions

Types

type CPUValues

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

CPUValues struct contains the last cpu-usage values in order to compute properly the current values. (see calculateCPUPercent() for more details)

type Collector

type Collector interface {
	Collect()
	Configure(map[string]interface{})

	// taken care of by the base class
	Name() string
	Channel() chan metric.Metric
	Interval() int
	SetInterval(int)
	CollectorType() string
	SetCollectorType(string)
	CanonicalName() string
	SetCanonicalName(string)
}

Collector defines the interface of a generic collector.

func New

func New(name string) Collector

New creates a new Collector based on the requested collector name.

func NewTest

func NewTest(channel chan metric.Metric, initialInterval int, log *l.Entry) Collector

NewTest creates a new Test collector.

type Diamond

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

Diamond collector type

func (*Diamond) CanonicalName

func (col *Diamond) CanonicalName() string

CanonicalName : collector canonical name

func (Diamond) Channel

func (col Diamond) Channel() chan metric.Metric

Channel : the channel on which the collector should send metrics

func (*Diamond) Collect

func (d *Diamond) Collect()

Collect reads metrics collected from Diamond collectors, converts them to fullerite's Metric type and publishes them to handlers.

func (*Diamond) CollectorType

func (col *Diamond) CollectorType() string

CollectorType : collector type

func (*Diamond) Configure

func (d *Diamond) Configure(configMap map[string]interface{})

Configure the collector

func (Diamond) Interval

func (col Diamond) Interval() int

Interval : the interval to collect the metrics on

func (Diamond) Name

func (col Diamond) Name() string

Name : the name of the collector

func (*Diamond) Port

func (d *Diamond) Port() string

Port returns Diamond collectors listen port

func (*Diamond) SetCanonicalName

func (col *Diamond) SetCanonicalName(name string)

SetCanonicalName : collector canonical name

func (*Diamond) SetCollectorType

func (col *Diamond) SetCollectorType(collectorType string)

SetCollectorType : collector type

func (*Diamond) SetInterval

func (col *Diamond) SetInterval(interval int)

SetInterval : set the interval to collect on

func (Diamond) String

func (col Diamond) String() string

String returns the collector name in printable format.

type DockerStats

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

DockerStats collector type. previousCPUValues contains the last cpu-usage values per container. dockerClient is the client for the Docker remote API.

func (*DockerStats) CanonicalName

func (col *DockerStats) CanonicalName() string

CanonicalName : collector canonical name

func (DockerStats) Channel

func (col DockerStats) Channel() chan metric.Metric

Channel : the channel on which the collector should send metrics

func (*DockerStats) Collect

func (d *DockerStats) Collect()

Collect iterates on all the docker containers alive and, if possible, collects the correspondent memory and cpu statistics. For each container a gorutine is started to spin up the collection process.

func (*DockerStats) CollectorType

func (col *DockerStats) CollectorType() string

CollectorType : collector type

func (*DockerStats) Configure

func (d *DockerStats) Configure(configMap map[string]interface{})

Configure takes a dictionary of values with which the handler can configure itself.

func (*DockerStats) GetEndpoint

func (d *DockerStats) GetEndpoint() string

GetEndpoint Returns endpoint of DockerStats instance

func (DockerStats) Interval

func (col DockerStats) Interval() int

Interval : the interval to collect the metrics on

func (DockerStats) Name

func (col DockerStats) Name() string

Name : the name of the collector

func (*DockerStats) SetCanonicalName

func (col *DockerStats) SetCanonicalName(name string)

SetCanonicalName : collector canonical name

func (*DockerStats) SetCollectorType

func (col *DockerStats) SetCollectorType(collectorType string)

SetCollectorType : collector type

func (*DockerStats) SetInterval

func (col *DockerStats) SetInterval(interval int)

SetInterval : set the interval to collect on

func (DockerStats) String

func (col DockerStats) String() string

String returns the collector name in printable format.

type Fullerite

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

Fullerite collector type

func (*Fullerite) CanonicalName

func (col *Fullerite) CanonicalName() string

CanonicalName : collector canonical name

func (Fullerite) Channel

func (col Fullerite) Channel() chan metric.Metric

Channel : the channel on which the collector should send metrics

func (Fullerite) Collect

func (f Fullerite) Collect()

Collect produces some random test metrics.

func (*Fullerite) CollectorType

func (col *Fullerite) CollectorType() string

CollectorType : collector type

func (*Fullerite) Configure

func (f *Fullerite) Configure(configMap map[string]interface{})

Configure this takes a dictionary of values with which the handler can configure itself

func (Fullerite) Interval

func (col Fullerite) Interval() int

Interval : the interval to collect the metrics on

func (Fullerite) Name

func (col Fullerite) Name() string

Name : the name of the collector

func (*Fullerite) SetCanonicalName

func (col *Fullerite) SetCanonicalName(name string)

SetCanonicalName : collector canonical name

func (*Fullerite) SetCollectorType

func (col *Fullerite) SetCollectorType(collectorType string)

SetCollectorType : collector type

func (*Fullerite) SetInterval

func (col *Fullerite) SetInterval(interval int)

SetInterval : set the interval to collect on

func (Fullerite) String

func (col Fullerite) String() string

String returns the collector name in printable format.

type OpenTSDB

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

OpenTSDB collector type

func (*OpenTSDB) CanonicalName

func (col *OpenTSDB) CanonicalName() string

CanonicalName : collector canonical name

func (OpenTSDB) Channel

func (col OpenTSDB) Channel() chan metric.Metric

Channel : the channel on which the collector should send metrics

func (*OpenTSDB) Collect

func (c *OpenTSDB) Collect()

Collect reads metrics collected from OpenTSDB collectors, converts them to fullerite's Metric type and publishes them to handlers.

func (*OpenTSDB) CollectorType

func (col *OpenTSDB) CollectorType() string

CollectorType : collector type

func (*OpenTSDB) Configure

func (c *OpenTSDB) Configure(configMap map[string]interface{})

Configure the collector

func (OpenTSDB) Interval

func (col OpenTSDB) Interval() int

Interval : the interval to collect the metrics on

func (OpenTSDB) Name

func (col OpenTSDB) Name() string

Name : the name of the collector

func (*OpenTSDB) Port

func (c *OpenTSDB) Port() string

Port returns collectors listen port

func (*OpenTSDB) SetCanonicalName

func (col *OpenTSDB) SetCanonicalName(name string)

SetCanonicalName : collector canonical name

func (*OpenTSDB) SetCollectorType

func (col *OpenTSDB) SetCollectorType(collectorType string)

SetCollectorType : collector type

func (*OpenTSDB) SetInterval

func (col *OpenTSDB) SetInterval(interval int)

SetInterval : set the interval to collect on

func (OpenTSDB) String

func (col OpenTSDB) String() string

String returns the collector name in printable format.

type Regex

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

Regex struct contains the info used to get the user specific dimensions from the docker env variables tag: is the environmental variable you want to get the value from regex: is the reg exp used to extract the value from the env var

type Test

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

Test collector type

func (*Test) CanonicalName

func (col *Test) CanonicalName() string

CanonicalName : collector canonical name

func (Test) Channel

func (col Test) Channel() chan metric.Metric

Channel : the channel on which the collector should send metrics

func (Test) Collect

func (t Test) Collect()

Collect produces some random test metrics.

func (*Test) CollectorType

func (col *Test) CollectorType() string

CollectorType : collector type

func (*Test) Configure

func (t *Test) Configure(configMap map[string]interface{})

Configure this takes a dictionary of values with which the handler can configure itself

func (Test) Interval

func (col Test) Interval() int

Interval : the interval to collect the metrics on

func (Test) Name

func (col Test) Name() string

Name : the name of the collector

func (*Test) SetCanonicalName

func (col *Test) SetCanonicalName(name string)

SetCanonicalName : collector canonical name

func (*Test) SetCollectorType

func (col *Test) SetCollectorType(collectorType string)

SetCollectorType : collector type

func (*Test) SetInterval

func (col *Test) SetInterval(interval int)

SetInterval : set the interval to collect on

func (Test) String

func (col Test) String() string

String returns the collector name in printable format.

Jump to

Keyboard shortcuts

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