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:
Calle Pettersson 2017-09-28 15:06:26 +02:00 committed by Johannes 'fish' Ziemke
commit 859a825bb8
58 changed files with 410 additions and 406 deletions

View file

@ -44,7 +44,7 @@ type devstatCollector struct {
}
func init() {
Factories["devstat"] = NewDevstatCollector
registerCollector("devstat", defaultDisabled, NewDevstatCollector)
}
// NewDevstatCollector returns a new Collector exposing Device stats.
@ -52,27 +52,27 @@ func NewDevstatCollector() (Collector, error) {
return &devstatCollector{
devinfo: &C.struct_devinfo{},
bytes: typedDesc{prometheus.NewDesc(
prometheus.BuildFQName(Namespace, devstatSubsystem, "bytes_total"),
prometheus.BuildFQName(namespace, devstatSubsystem, "bytes_total"),
"The total number of bytes in transactions.",
[]string{"device", "type"}, nil,
), prometheus.CounterValue},
transfers: typedDesc{prometheus.NewDesc(
prometheus.BuildFQName(Namespace, devstatSubsystem, "transfers_total"),
prometheus.BuildFQName(namespace, devstatSubsystem, "transfers_total"),
"The total number of transactions.",
[]string{"device", "type"}, nil,
), prometheus.CounterValue},
duration: typedDesc{prometheus.NewDesc(
prometheus.BuildFQName(Namespace, devstatSubsystem, "duration_seconds_total"),
prometheus.BuildFQName(namespace, devstatSubsystem, "duration_seconds_total"),
"The total duration of transactions in seconds.",
[]string{"device", "type"}, nil,
), prometheus.CounterValue},
busyTime: typedDesc{prometheus.NewDesc(
prometheus.BuildFQName(Namespace, devstatSubsystem, "busy_time_seconds_total"),
prometheus.BuildFQName(namespace, devstatSubsystem, "busy_time_seconds_total"),
"Total time the device had one or more transactions outstanding in seconds.",
[]string{"device"}, nil,
), prometheus.CounterValue},
blocks: typedDesc{prometheus.NewDesc(
prometheus.BuildFQName(Namespace, devstatSubsystem, "blocks_transferred_total"),
prometheus.BuildFQName(namespace, devstatSubsystem, "blocks_transferred_total"),
"The total number of blocks transferred.",
[]string{"device"}, nil,
), prometheus.CounterValue},