collector

package
v0.0.0-...-7f30026 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2016 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package collector contains the actual qcollect 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 qcollect 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 (
	// 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"
)
View Source
const (
	//DefaultOpenTSDBCollectorPort is the TCP port that OpenTSDB clients will push data to
	DefaultOpenTSDBCollectorPort = "4242"
)

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 CntStat

type CntStat struct {
	Container types.Container
	Stats     types.StatsJSON
	Ok        bool
}

CntStat is encapsulate a fetch container stats for a gochannel

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 qcollect'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) DiffCPUStats

func (d DockerStats) DiffCPUStats(pre types.CPUStats, cur types.CPUStats) types.CPUStats

DiffCPUStats create a diff out of two CPUStats

func (DockerStats) DiffCPUUsage

func (d DockerStats) DiffCPUUsage(pre types.CPUUsage, cur types.CPUUsage, sysusage uint64) types.CPUUsage

DiffCPUUsage create a diff out ot two (plus knowledge about the system usage)

func (DockerStats) DiffThrottlingData

func (d DockerStats) DiffThrottlingData(pre types.ThrottlingData, cur types.ThrottlingData) types.ThrottlingData

DiffThrottlingData diffs two ThrottlingData

func (*DockerStats) GetBlkIO

func (d *DockerStats) GetBlkIO() bool

GetBlkIO returns blkIO

func (*DockerStats) GetBufferRegex

func (d *DockerStats) GetBufferRegex() string

GetBufferRegex Returns bufferRegex

func (*DockerStats) GetCPUThrottle

func (d *DockerStats) GetCPUThrottle() bool

GetCPUThrottle returns cpuThrottle

func (*DockerStats) GetEndpoint

func (d *DockerStats) GetEndpoint() string

GetEndpoint Returns endpoint of DockerStats instance

func (*DockerStats) GetPerCore

func (d *DockerStats) GetPerCore() bool

GetPerCore returns perCore

func (*DockerStats) GetSkipRegex

func (d *DockerStats) GetSkipRegex() string

GetSkipRegex Returns bufferRegex

func (*DockerStats) GetStatsTimeout

func (d *DockerStats) GetStatsTimeout() int

GetStatsTimeout returns timeout config

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 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 qcollect'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 Prometheus

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

Prometheus collector type. Fetches metrics from Prometheus endpoint

func (*Prometheus) CanonicalName

func (col *Prometheus) CanonicalName() string

CanonicalName : collector canonical name

func (Prometheus) Channel

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

Channel : the channel on which the collector should send metrics

func (*Prometheus) Collect

func (p *Prometheus) Collect()

Collect fetches the endpoint and adds it to the channel

func (*Prometheus) CollectorType

func (col *Prometheus) CollectorType() string

CollectorType : collector type

func (*Prometheus) Configure

func (p *Prometheus) Configure(configMap map[string]interface{})

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

func (*Prometheus) GetEndpoint

func (p *Prometheus) GetEndpoint() string

GetEndpoint Returns endpoint of instance

func (Prometheus) Interval

func (col Prometheus) Interval() int

Interval : the interval to collect the metrics on

func (Prometheus) Name

func (col Prometheus) Name() string

Name : the name of the collector

func (*Prometheus) SetCanonicalName

func (col *Prometheus) SetCanonicalName(name string)

SetCanonicalName : collector canonical name

func (*Prometheus) SetCollectorType

func (col *Prometheus) SetCollectorType(collectorType string)

SetCollectorType : collector type

func (*Prometheus) SetInterval

func (col *Prometheus) SetInterval(interval int)

SetInterval : set the interval to collect on

func (Prometheus) String

func (col Prometheus) String() string

String returns the collector name in printable format.

type Qcollect

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

Qcollect collector type

func (*Qcollect) CanonicalName

func (col *Qcollect) CanonicalName() string

CanonicalName : collector canonical name

func (Qcollect) Channel

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

Channel : the channel on which the collector should send metrics

func (Qcollect) Collect

func (f Qcollect) Collect()

Collect produces some random test metrics.

func (*Qcollect) CollectorType

func (col *Qcollect) CollectorType() string

CollectorType : collector type

func (*Qcollect) Configure

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

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

func (Qcollect) Interval

func (col Qcollect) Interval() int

Interval : the interval to collect the metrics on

func (Qcollect) Name

func (col Qcollect) Name() string

Name : the name of the collector

func (*Qcollect) SetCanonicalName

func (col *Qcollect) SetCanonicalName(name string)

SetCanonicalName : collector canonical name

func (*Qcollect) SetCollectorType

func (col *Qcollect) SetCollectorType(collectorType string)

SetCollectorType : collector type

func (*Qcollect) SetInterval

func (col *Qcollect) SetInterval(interval int)

SetInterval : set the interval to collect on

func (Qcollect) String

func (col Qcollect) 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