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

@ -33,7 +33,7 @@ type ipvsCollector struct {
}
func init() {
Factories["ipvs"] = NewIPVSCollector
registerCollector("ipvs", defaultEnabled, NewIPVSCollector)
}
// NewIPVSCollector sets up a new collector for IPVS metrics. It accepts the
@ -62,42 +62,42 @@ func newIPVSCollector() (*ipvsCollector, error) {
}
c.connections = typedDesc{prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "connections_total"),
prometheus.BuildFQName(namespace, subsystem, "connections_total"),
"The total number of connections made.",
nil, nil,
), prometheus.CounterValue}
c.incomingPackets = typedDesc{prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "incoming_packets_total"),
prometheus.BuildFQName(namespace, subsystem, "incoming_packets_total"),
"The total number of incoming packets.",
nil, nil,
), prometheus.CounterValue}
c.outgoingPackets = typedDesc{prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "outgoing_packets_total"),
prometheus.BuildFQName(namespace, subsystem, "outgoing_packets_total"),
"The total number of outgoing packets.",
nil, nil,
), prometheus.CounterValue}
c.incomingBytes = typedDesc{prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "incoming_bytes_total"),
prometheus.BuildFQName(namespace, subsystem, "incoming_bytes_total"),
"The total amount of incoming data.",
nil, nil,
), prometheus.CounterValue}
c.outgoingBytes = typedDesc{prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "outgoing_bytes_total"),
prometheus.BuildFQName(namespace, subsystem, "outgoing_bytes_total"),
"The total amount of outgoing data.",
nil, nil,
), prometheus.CounterValue}
c.backendConnectionsActive = typedDesc{prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "backend_connections_active"),
prometheus.BuildFQName(namespace, subsystem, "backend_connections_active"),
"The current active connections by local and remote address.",
ipvsBackendLabelNames, nil,
), prometheus.GaugeValue}
c.backendConnectionsInact = typedDesc{prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "backend_connections_inactive"),
prometheus.BuildFQName(namespace, subsystem, "backend_connections_inactive"),
"The current inactive connections by local and remote address.",
ipvsBackendLabelNames, nil,
), prometheus.GaugeValue}
c.backendWeight = typedDesc{prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "backend_weight"),
prometheus.BuildFQName(namespace, subsystem, "backend_weight"),
"The current backend weight by local and remote address.",
ipvsBackendLabelNames, nil,
), prometheus.GaugeValue}