Replace --collectors.enabled with per-collector flags (#640)
* Move NodeCollector into package collector * Refactor collector enabling * Update README with new collector enabled flags * Fix out-of-date inline flag reference syntax * Use new flags in end-to-end tests * Add flag to disable all default collectors * Track if a flag has been set explicitly * Add --collectors.disable-defaults to README * Revert disable-defaults flag * Shorten flags * Fixup timex collector registration * Fix end-to-end tests * Change procfs and sysfs path flags * Fix review comments
This commit is contained in:
parent
3762191e66
commit
859a825bb8
58 changed files with 410 additions and 406 deletions
|
|
@ -29,7 +29,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
cpuCollectorNamespace = "cpu"
|
||||
cpuCollectorSubsystem = "cpu"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -46,40 +46,40 @@ type cpuCollector struct {
|
|||
}
|
||||
|
||||
func init() {
|
||||
Factories["cpu"] = NewCPUCollector
|
||||
registerCollector("cpu", defaultEnabled, NewCPUCollector)
|
||||
}
|
||||
|
||||
// NewCPUCollector returns a new Collector exposing kernel/system statistics.
|
||||
func NewCPUCollector() (Collector, error) {
|
||||
return &cpuCollector{
|
||||
cpu: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, "", cpuCollectorNamespace),
|
||||
prometheus.BuildFQName(namespace, "", cpuCollectorSubsystem),
|
||||
"Seconds the cpus spent in each mode.",
|
||||
[]string{"cpu", "mode"}, nil,
|
||||
),
|
||||
cpuFreq: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, cpuCollectorNamespace, "frequency_hertz"),
|
||||
prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "frequency_hertz"),
|
||||
"Current cpu thread frequency in hertz.",
|
||||
[]string{"cpu"}, nil,
|
||||
),
|
||||
cpuFreqMin: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, cpuCollectorNamespace, "frequency_min_hertz"),
|
||||
prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "frequency_min_hertz"),
|
||||
"Minimum cpu thread frequency in hertz.",
|
||||
[]string{"cpu"}, nil,
|
||||
),
|
||||
cpuFreqMax: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, cpuCollectorNamespace, "frequency_max_hertz"),
|
||||
prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "frequency_max_hertz"),
|
||||
"Maximum cpu thread frequency in hertz.",
|
||||
[]string{"cpu"}, nil,
|
||||
),
|
||||
// FIXME: This should be a per core metric, not per cpu!
|
||||
cpuCoreThrottle: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, cpuCollectorNamespace, "core_throttles_total"),
|
||||
prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "core_throttles_total"),
|
||||
"Number of times this cpu core has been throttled.",
|
||||
[]string{"cpu"}, nil,
|
||||
),
|
||||
cpuPackageThrottle: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, cpuCollectorNamespace, "package_throttles_total"),
|
||||
prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "package_throttles_total"),
|
||||
"Number of times this cpu package has been throttled.",
|
||||
[]string{"node"}, nil,
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue