Fix some golint issues (#927)

* collector/cpu_*: rename nodeCpuSecondsDesc to nodeCPUSecondsDesc

Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>

* collector/qdisc_linux.go: add NewQdiscStatCollector comment

Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>

* collector/cpu_linux.go: rename core_map to coreMap

Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
This commit is contained in:
Mario Trangoni 2018-04-29 14:34:47 +02:00 committed by Johannes 'fish' Ziemke
parent 7073dcdcb5
commit c9f421d0dd
7 changed files with 9 additions and 8 deletions

View File

@ -24,7 +24,7 @@ const (
) )
var ( var (
nodeCpuSecondsDesc = prometheus.NewDesc( nodeCPUSecondsDesc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "seconds_total"), prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "seconds_total"),
"Seconds the cpus spent in each mode.", "Seconds the cpus spent in each mode.",
[]string{"cpu", "mode"}, nil, []string{"cpu", "mode"}, nil,

View File

@ -59,7 +59,7 @@ func init() {
// NewCPUCollector returns a new Collector exposing CPU stats. // NewCPUCollector returns a new Collector exposing CPU stats.
func NewCPUCollector() (Collector, error) { func NewCPUCollector() (Collector, error) {
return &statCollector{ return &statCollector{
cpu: nodeCpuSecondsDesc, cpu: nodeCPUSecondsDesc,
}, nil }, nil
} }

View File

@ -94,7 +94,7 @@ func init() {
// NewStatCollector returns a new Collector exposing CPU stats. // NewStatCollector returns a new Collector exposing CPU stats.
func NewStatCollector() (Collector, error) { func NewStatCollector() (Collector, error) {
return &statCollector{ return &statCollector{
cpu: nodeCpuSecondsDesc, cpu: nodeCPUSecondsDesc,
}, nil }, nil
} }

View File

@ -92,7 +92,7 @@ func init() {
// NewStatCollector returns a new Collector exposing CPU stats. // NewStatCollector returns a new Collector exposing CPU stats.
func NewStatCollector() (Collector, error) { func NewStatCollector() (Collector, error) {
return &statCollector{ return &statCollector{
cpu: typedDesc{nodeCpuSecondsDesc, prometheus.CounterValue}, cpu: typedDesc{nodeCPUSecondsDesc, prometheus.CounterValue},
temp: typedDesc{prometheus.NewDesc( temp: typedDesc{prometheus.NewDesc(
prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "temperature_celsius"), prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "temperature_celsius"),
"CPU temperature", "CPU temperature",

View File

@ -49,7 +49,7 @@ func init() {
// NewCPUCollector returns a new Collector exposing kernel/system statistics. // NewCPUCollector returns a new Collector exposing kernel/system statistics.
func NewCPUCollector() (Collector, error) { func NewCPUCollector() (Collector, error) {
return &cpuCollector{ return &cpuCollector{
cpu: nodeCpuSecondsDesc, cpu: nodeCPUSecondsDesc,
cpuGuest: prometheus.NewDesc( cpuGuest: prometheus.NewDesc(
prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "guest_seconds_total"), prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "guest_seconds_total"),
"Seconds the cpus spent in guests (VMs) for each mode.", "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)) strconv.FormatUint(physicalPackageID, 10))
} }
for physicalPackageID, core_map := range packageCoreThrottles { for physicalPackageID, coreMap := range packageCoreThrottles {
for coreID, coreThrottleCount := range core_map { for coreID, coreThrottleCount := range coreMap {
ch <- prometheus.MustNewConstMetric(c.cpuCoreThrottle, ch <- prometheus.MustNewConstMetric(c.cpuCoreThrottle,
prometheus.CounterValue, prometheus.CounterValue,
float64(coreThrottleCount), float64(coreThrottleCount),

View File

@ -39,7 +39,7 @@ func init() {
func NewCpuCollector() (Collector, error) { func NewCpuCollector() (Collector, error) {
return &cpuCollector{ return &cpuCollector{
cpu: typedDesc{nodeCpuSecondsDesc, prometheus.CounterValue}, cpu: typedDesc{nodeCPUSecondsDesc, prometheus.CounterValue},
}, nil }, nil
} }

View File

@ -41,6 +41,7 @@ func init() {
registerCollector("qdisc", defaultDisabled, NewQdiscStatCollector) registerCollector("qdisc", defaultDisabled, NewQdiscStatCollector)
} }
// NewQdiscStatCollector returns a new Collector exposing queuing discipline statistics.
func NewQdiscStatCollector() (Collector, error) { func NewQdiscStatCollector() (Collector, error) {
return &qdiscStatCollector{ return &qdiscStatCollector{
bytes: typedDesc{prometheus.NewDesc( bytes: typedDesc{prometheus.NewDesc(