mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2025-04-10 07:25:54 +02:00
Avoid staticcheck warning: redundant return statement
This commit is contained in:
parent
7a54a9b170
commit
699f69ff59
@ -3,11 +3,12 @@ package collectors
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
||||||
)
|
)
|
||||||
|
|
||||||
const CPUSTATFILE = `/proc/stat`
|
const CPUSTATFILE = `/proc/stat`
|
||||||
@ -89,5 +90,4 @@ func (m *CpustatCollector) Read(interval time.Duration, output chan lp.CCMetric)
|
|||||||
|
|
||||||
func (m *CpustatCollector) Close() {
|
func (m *CpustatCollector) Close() {
|
||||||
m.init = false
|
m.init = false
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,14 @@ package collectors
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
|
||||||
influx "github.com/influxdata/line-protocol"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
||||||
|
influx "github.com/influxdata/line-protocol"
|
||||||
)
|
)
|
||||||
|
|
||||||
const CUSTOMCMDPATH = `/home/unrz139/Work/cc-metric-collector/collectors/custom`
|
const CUSTOMCMDPATH = `/home/unrz139/Work/cc-metric-collector/collectors/custom`
|
||||||
@ -128,5 +129,4 @@ func (m *CustomCmdCollector) Read(interval time.Duration, output chan lp.CCMetri
|
|||||||
|
|
||||||
func (m *CustomCmdCollector) Close() {
|
func (m *CustomCmdCollector) Close() {
|
||||||
m.init = false
|
m.init = false
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package collectors
|
package collectors
|
||||||
|
|
||||||
import (
|
import (
|
||||||
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
||||||
|
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
||||||
|
|
||||||
// "log"
|
// "log"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
@ -108,10 +110,8 @@ func (m *DiskstatCollector) Read(interval time.Duration, output chan lp.CCMetric
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *DiskstatCollector) Close() {
|
func (m *DiskstatCollector) Close() {
|
||||||
m.init = false
|
m.init = false
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
@ -17,14 +17,12 @@ import (
|
|||||||
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
||||||
)
|
)
|
||||||
|
|
||||||
type GpfsCollectorConfig struct {
|
|
||||||
Mmpmon string `json:"mmpmon"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type GpfsCollector struct {
|
type GpfsCollector struct {
|
||||||
metricCollector
|
metricCollector
|
||||||
tags map[string]string
|
tags map[string]string
|
||||||
config GpfsCollectorConfig
|
config struct {
|
||||||
|
Mmpmon string `json:"mmpmon"`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *GpfsCollector) Init(config json.RawMessage) error {
|
func (m *GpfsCollector) Init(config json.RawMessage) error {
|
||||||
@ -243,5 +241,4 @@ func (m *GpfsCollector) Read(interval time.Duration, output chan lp.CCMetric) {
|
|||||||
|
|
||||||
func (m *GpfsCollector) Close() {
|
func (m *GpfsCollector) Close() {
|
||||||
m.init = false
|
m.init = false
|
||||||
return
|
|
||||||
}
|
}
|
@ -240,5 +240,4 @@ func (m *InfinibandCollector) Read(interval time.Duration, output chan lp.CCMetr
|
|||||||
|
|
||||||
func (m *InfinibandCollector) Close() {
|
func (m *InfinibandCollector) Close() {
|
||||||
m.init = false
|
m.init = false
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,14 @@ package collectors
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
||||||
)
|
)
|
||||||
|
|
||||||
const IPMITOOL_PATH = `/usr/bin/ipmitool`
|
const IPMITOOL_PATH = `/usr/bin/ipmitool`
|
||||||
@ -138,5 +139,4 @@ func (m *IpmiCollector) Read(interval time.Duration, output chan lp.CCMetric) {
|
|||||||
|
|
||||||
func (m *IpmiCollector) Close() {
|
func (m *IpmiCollector) Close() {
|
||||||
m.init = false
|
m.init = false
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
|
||||||
"gopkg.in/Knetic/govaluate.v2"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"math"
|
"math"
|
||||||
@ -22,6 +20,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
|
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
||||||
|
"gopkg.in/Knetic/govaluate.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
type MetricScope int
|
type MetricScope int
|
||||||
@ -326,5 +327,4 @@ func (m *LikwidCollector) Close() {
|
|||||||
C.perfmon_finalize()
|
C.perfmon_finalize()
|
||||||
C.topology_finalize()
|
C.topology_finalize()
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,12 @@ package collectors
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
||||||
)
|
)
|
||||||
|
|
||||||
const LOADAVGFILE = `/proc/loadavg`
|
const LOADAVGFILE = `/proc/loadavg`
|
||||||
@ -77,5 +78,4 @@ func (m *LoadavgCollector) Read(interval time.Duration, output chan lp.CCMetric)
|
|||||||
|
|
||||||
func (m *LoadavgCollector) Close() {
|
func (m *LoadavgCollector) Close() {
|
||||||
m.init = false
|
m.init = false
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,13 @@ package collectors
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
||||||
)
|
)
|
||||||
|
|
||||||
const LUSTREFILE = `/proc/fs/lustre/llite/lnec-XXXXXX/stats`
|
const LUSTREFILE = `/proc/fs/lustre/llite/lnec-XXXXXX/stats`
|
||||||
@ -106,5 +107,4 @@ func (m *LustreCollector) Read(interval time.Duration, output chan lp.CCMetric)
|
|||||||
|
|
||||||
func (m *LustreCollector) Close() {
|
func (m *LustreCollector) Close() {
|
||||||
m.init = false
|
m.init = false
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
@ -4,12 +4,13 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
||||||
)
|
)
|
||||||
|
|
||||||
const MEMSTATFILE = `/proc/meminfo`
|
const MEMSTATFILE = `/proc/meminfo`
|
||||||
@ -126,5 +127,4 @@ func (m *MemstatCollector) Read(interval time.Duration, output chan lp.CCMetric)
|
|||||||
|
|
||||||
func (m *MemstatCollector) Close() {
|
func (m *MemstatCollector) Close() {
|
||||||
m.init = false
|
m.init = false
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,13 @@ package collectors
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
||||||
)
|
)
|
||||||
|
|
||||||
const NETSTATFILE = `/proc/net/dev`
|
const NETSTATFILE = `/proc/net/dev`
|
||||||
@ -91,5 +92,4 @@ func (m *NetstatCollector) Read(interval time.Duration, output chan lp.CCMetric)
|
|||||||
|
|
||||||
func (m *NetstatCollector) Close() {
|
func (m *NetstatCollector) Close() {
|
||||||
m.init = false
|
m.init = false
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,11 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
|
||||||
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
|
||||||
"log"
|
"log"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
||||||
|
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||||
)
|
)
|
||||||
|
|
||||||
type NvidiaCollectorConfig struct {
|
type NvidiaCollectorConfig struct {
|
||||||
@ -271,5 +272,4 @@ func (m *NvidiaCollector) Close() {
|
|||||||
nvml.Shutdown()
|
nvml.Shutdown()
|
||||||
m.init = false
|
m.init = false
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package collectors
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
@ -11,6 +10,8 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
||||||
)
|
)
|
||||||
|
|
||||||
const HWMON_PATH = `/sys/class/hwmon`
|
const HWMON_PATH = `/sys/class/hwmon`
|
||||||
@ -112,5 +113,4 @@ func (m *TempCollector) Read(interval time.Duration, output chan lp.CCMetric) {
|
|||||||
|
|
||||||
func (m *TempCollector) Close() {
|
func (m *TempCollector) Close() {
|
||||||
m.init = false
|
m.init = false
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,12 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
|
||||||
"log"
|
"log"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
||||||
)
|
)
|
||||||
|
|
||||||
const MAX_NUM_PROCS = 10
|
const MAX_NUM_PROCS = 10
|
||||||
@ -75,5 +76,4 @@ func (m *TopProcsCollector) Read(interval time.Duration, output chan lp.CCMetric
|
|||||||
|
|
||||||
func (m *TopProcsCollector) Close() {
|
func (m *TopProcsCollector) Close() {
|
||||||
m.init = false
|
m.init = false
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,12 @@ package sinks
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
|
||||||
|
|
||||||
|
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
||||||
|
)
|
||||||
|
|
||||||
var AvailableSinks = map[string]Sink{
|
var AvailableSinks = map[string]Sink{
|
||||||
"influxdb": &InfluxSink{},
|
"influxdb": &InfluxSink{},
|
||||||
@ -129,7 +129,6 @@ func (sm *sinkManager) AddOutput(rawConfig json.RawMessage) error {
|
|||||||
func (sm *sinkManager) Close() {
|
func (sm *sinkManager) Close() {
|
||||||
sm.done <- true
|
sm.done <- true
|
||||||
log.Print("[SinkManager] CLOSE")
|
log.Print("[SinkManager] CLOSE")
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(wg *sync.WaitGroup, sinkConfigFile string) (SinkManager, error) {
|
func New(wg *sync.WaitGroup, sinkConfigFile string) (SinkManager, error) {
|
||||||
|
@ -66,6 +66,4 @@ func (s *StdoutSink) Flush() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StdoutSink) Close() {
|
func (s *StdoutSink) Close() {}
|
||||||
return
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user