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
- func RegisterCollector(name string, f func(chan metric.Metric, int, *l.Entry) Collector)
- type CPUValues
- type CntStat
- type Collector
- type Diamond
- func (col *Diamond) CanonicalName() string
- func (col Diamond) Channel() chan metric.Metric
- func (d *Diamond) Collect()
- func (col *Diamond) CollectorType() string
- func (d *Diamond) Configure(configMap map[string]interface{})
- func (col Diamond) Interval() int
- func (col Diamond) Name() string
- func (d *Diamond) Port() string
- func (col *Diamond) SetCanonicalName(name string)
- func (col *Diamond) SetCollectorType(collectorType string)
- func (col *Diamond) SetInterval(interval int)
- func (col Diamond) String() string
- type DockerStats
- func (col *DockerStats) CanonicalName() string
- func (col DockerStats) Channel() chan metric.Metric
- func (d *DockerStats) Collect()
- func (col *DockerStats) CollectorType() string
- func (d *DockerStats) Configure(configMap map[string]interface{})
- func (d DockerStats) DiffCPUStats(pre types.CPUStats, cur types.CPUStats) types.CPUStats
- func (d DockerStats) DiffCPUUsage(pre types.CPUUsage, cur types.CPUUsage, sysusage uint64) types.CPUUsage
- func (d DockerStats) DiffThrottlingData(pre types.ThrottlingData, cur types.ThrottlingData) types.ThrottlingData
- func (d *DockerStats) GetBlkIO() bool
- func (d *DockerStats) GetBufferRegex() string
- func (d *DockerStats) GetCPUThrottle() bool
- func (d *DockerStats) GetEndpoint() string
- func (d *DockerStats) GetPerCore() bool
- func (d *DockerStats) GetSkipRegex() string
- func (d *DockerStats) GetStatsTimeout() int
- func (col DockerStats) Interval() int
- func (col DockerStats) Name() string
- func (col *DockerStats) SetCanonicalName(name string)
- func (col *DockerStats) SetCollectorType(collectorType string)
- func (col *DockerStats) SetInterval(interval int)
- func (col DockerStats) String() string
- type OpenTSDB
- func (col *OpenTSDB) CanonicalName() string
- func (col OpenTSDB) Channel() chan metric.Metric
- func (c *OpenTSDB) Collect()
- func (col *OpenTSDB) CollectorType() string
- func (c *OpenTSDB) Configure(configMap map[string]interface{})
- func (col OpenTSDB) Interval() int
- func (col OpenTSDB) Name() string
- func (c *OpenTSDB) Port() string
- func (col *OpenTSDB) SetCanonicalName(name string)
- func (col *OpenTSDB) SetCollectorType(collectorType string)
- func (col *OpenTSDB) SetInterval(interval int)
- func (col OpenTSDB) String() string
- type Prometheus
- func (col *Prometheus) CanonicalName() string
- func (col Prometheus) Channel() chan metric.Metric
- func (p *Prometheus) Collect()
- func (col *Prometheus) CollectorType() string
- func (p *Prometheus) Configure(configMap map[string]interface{})
- func (p *Prometheus) GetEndpoint() string
- func (col Prometheus) Interval() int
- func (col Prometheus) Name() string
- func (col *Prometheus) SetCanonicalName(name string)
- func (col *Prometheus) SetCollectorType(collectorType string)
- func (col *Prometheus) SetInterval(interval int)
- func (col Prometheus) String() string
- type Qcollect
- func (col *Qcollect) CanonicalName() string
- func (col Qcollect) Channel() chan metric.Metric
- func (f Qcollect) Collect()
- func (col *Qcollect) CollectorType() string
- func (f *Qcollect) Configure(configMap map[string]interface{})
- func (col Qcollect) Interval() int
- func (col Qcollect) Name() string
- func (col *Qcollect) SetCanonicalName(name string)
- func (col *Qcollect) SetCollectorType(collectorType string)
- func (col *Qcollect) SetInterval(interval int)
- func (col Qcollect) String() string
- type Regex
- type Test
- func (col *Test) CanonicalName() string
- func (col Test) Channel() chan metric.Metric
- func (t Test) Collect()
- func (col *Test) CollectorType() string
- func (t *Test) Configure(configMap map[string]interface{})
- func (col Test) Interval() int
- func (col Test) Name() string
- func (col *Test) SetCanonicalName(name string)
- func (col *Test) SetCollectorType(collectorType string)
- func (col *Test) SetInterval(interval int)
- func (col Test) String() string
Constants ¶
const (
// DefaultCollectionInterval the interval to collect on unless overridden by a collectors config
DefaultCollectionInterval = 10
)
const ( // DefaultDiamondCollectorPort is the TCP port that diamond // collectors write to and we read off of. DefaultDiamondCollectorPort = "19191" )
const (
//DefaultOpenTSDBCollectorPort is the TCP port that OpenTSDB clients will push data to
DefaultOpenTSDBCollectorPort = "4242"
)
Variables ¶
This section is empty.
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.
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) 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) Interval ¶
func (col Diamond) Interval() int
Interval : the interval to collect the metrics on
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
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) 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 ¶
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) 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) 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) 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
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) 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) Interval ¶
func (col OpenTSDB) Interval() int
Interval : the interval to collect the metrics on
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
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) 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) 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
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) CollectorType ¶
func (col *Qcollect) CollectorType() string
CollectorType : collector type
func (*Qcollect) Configure ¶
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) 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
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) Configure ¶
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) 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