From c9f421d0dd8699396b3fd94dc6e595475d28ad1e Mon Sep 17 00:00:00 2001 From: Mario Trangoni Date: Sun, 29 Apr 2018 14:34:47 +0200 Subject: [PATCH] Fix some golint issues (#927) * collector/cpu_*: rename nodeCpuSecondsDesc to nodeCPUSecondsDesc Signed-off-by: Mario Trangoni * collector/qdisc_linux.go: add NewQdiscStatCollector comment Signed-off-by: Mario Trangoni * collector/cpu_linux.go: rename core_map to coreMap Signed-off-by: Mario Trangoni --- collector/cpu_common.go | 2 +- collector/cpu_darwin.go | 2 +- collector/cpu_dragonfly.go | 2 +- collector/cpu_freebsd.go | 2 +- collector/cpu_linux.go | 6 +++--- collector/cpu_openbsd.go | 2 +- collector/qdisc_linux.go | 1 + 7 files changed, 9 insertions(+), 8 deletions(-) diff --git a/collector/cpu_common.go b/collector/cpu_common.go index 6a540f4e..1a786076 100644 --- a/collector/cpu_common.go +++ b/collector/cpu_common.go @@ -24,7 +24,7 @@ const ( ) var ( - nodeCpuSecondsDesc = prometheus.NewDesc( + nodeCPUSecondsDesc = prometheus.NewDesc( prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "seconds_total"), "Seconds the cpus spent in each mode.", []string{"cpu", "mode"}, nil, diff --git a/collector/cpu_darwin.go b/collector/cpu_darwin.go index caa59f8c..74afafdc 100644 --- a/collector/cpu_darwin.go +++ b/collector/cpu_darwin.go @@ -59,7 +59,7 @@ func init() { // NewCPUCollector returns a new Collector exposing CPU stats. func NewCPUCollector() (Collector, error) { return &statCollector{ - cpu: nodeCpuSecondsDesc, + cpu: nodeCPUSecondsDesc, }, nil } diff --git a/collector/cpu_dragonfly.go b/collector/cpu_dragonfly.go index 76ae33b8..eb7f8f8a 100644 --- a/collector/cpu_dragonfly.go +++ b/collector/cpu_dragonfly.go @@ -94,7 +94,7 @@ func init() { // NewStatCollector returns a new Collector exposing CPU stats. func NewStatCollector() (Collector, error) { return &statCollector{ - cpu: nodeCpuSecondsDesc, + cpu: nodeCPUSecondsDesc, }, nil } diff --git a/collector/cpu_freebsd.go b/collector/cpu_freebsd.go index e99174a9..e8d2fb98 100644 --- a/collector/cpu_freebsd.go +++ b/collector/cpu_freebsd.go @@ -92,7 +92,7 @@ func init() { // NewStatCollector returns a new Collector exposing CPU stats. func NewStatCollector() (Collector, error) { return &statCollector{ - cpu: typedDesc{nodeCpuSecondsDesc, prometheus.CounterValue}, + cpu: typedDesc{nodeCPUSecondsDesc, prometheus.CounterValue}, temp: typedDesc{prometheus.NewDesc( prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "temperature_celsius"), "CPU temperature", diff --git a/collector/cpu_linux.go b/collector/cpu_linux.go index f9354564..e79d00c3 100644 --- a/collector/cpu_linux.go +++ b/collector/cpu_linux.go @@ -49,7 +49,7 @@ func init() { // NewCPUCollector returns a new Collector exposing kernel/system statistics. func NewCPUCollector() (Collector, error) { return &cpuCollector{ - cpu: nodeCpuSecondsDesc, + cpu: nodeCPUSecondsDesc, cpuGuest: prometheus.NewDesc( prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "guest_seconds_total"), "Seconds the cpus spent in guests (VMs) for each mode.", @@ -185,8 +185,8 @@ func (c *cpuCollector) updateCPUfreq(ch chan<- prometheus.Metric) error { strconv.FormatUint(physicalPackageID, 10)) } - for physicalPackageID, core_map := range packageCoreThrottles { - for coreID, coreThrottleCount := range core_map { + for physicalPackageID, coreMap := range packageCoreThrottles { + for coreID, coreThrottleCount := range coreMap { ch <- prometheus.MustNewConstMetric(c.cpuCoreThrottle, prometheus.CounterValue, float64(coreThrottleCount), diff --git a/collector/cpu_openbsd.go b/collector/cpu_openbsd.go index 0b05d551..e9b102fe 100644 --- a/collector/cpu_openbsd.go +++ b/collector/cpu_openbsd.go @@ -39,7 +39,7 @@ func init() { func NewCpuCollector() (Collector, error) { return &cpuCollector{ - cpu: typedDesc{nodeCpuSecondsDesc, prometheus.CounterValue}, + cpu: typedDesc{nodeCPUSecondsDesc, prometheus.CounterValue}, }, nil } diff --git a/collector/qdisc_linux.go b/collector/qdisc_linux.go index d96e7bd4..74757b3a 100644 --- a/collector/qdisc_linux.go +++ b/collector/qdisc_linux.go @@ -41,6 +41,7 @@ func init() { registerCollector("qdisc", defaultDisabled, NewQdiscStatCollector) } +// NewQdiscStatCollector returns a new Collector exposing queuing discipline statistics. func NewQdiscStatCollector() (Collector, error) { return &qdiscStatCollector{ bytes: typedDesc{prometheus.NewDesc(