collector: fix golint problems in ZFS collector (#1132)
Signed-off-by: Matt Layher <mdlayher@gmail.com>pull/1128/head
parent
7519967619
commit
3d798aa4a1
|
@ -29,14 +29,14 @@ import (
|
||||||
// constants from https://github.com/zfsonlinux/zfs/blob/master/lib/libspl/include/sys/kstat.h
|
// constants from https://github.com/zfsonlinux/zfs/blob/master/lib/libspl/include/sys/kstat.h
|
||||||
// kept as strings for comparison thus avoiding conversion to int
|
// kept as strings for comparison thus avoiding conversion to int
|
||||||
const (
|
const (
|
||||||
KSTAT_DATA_CHAR = "0"
|
kstatDataChar = "0"
|
||||||
KSTAT_DATA_INT32 = "1"
|
kstatDataInt32 = "1"
|
||||||
KSTAT_DATA_UINT32 = "2"
|
kstatDataUint32 = "2"
|
||||||
KSTAT_DATA_INT64 = "3"
|
kstatDataInt64 = "3"
|
||||||
KSTAT_DATA_UINT64 = "4"
|
kstatDataUint64 = "4"
|
||||||
KSTAT_DATA_LONG = "5"
|
kstatDataLong = "5"
|
||||||
KSTAT_DATA_ULONG = "6"
|
kstatDataUlong = "6"
|
||||||
KSTAT_DATA_STRING = "7"
|
kstatDataString = "7"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c *zfsCollector) openProcFile(path string) (*os.File, error) {
|
func (c *zfsCollector) openProcFile(path string) (*os.File, error) {
|
||||||
|
@ -112,7 +112,7 @@ func (c *zfsCollector) parseProcfsFile(reader io.Reader, fmtExt string, handler
|
||||||
|
|
||||||
// kstat data type (column 2) should be KSTAT_DATA_UINT64, otherwise ignore
|
// kstat data type (column 2) should be KSTAT_DATA_UINT64, otherwise ignore
|
||||||
// TODO: when other KSTAT_DATA_* types arrive, much of this will need to be restructured
|
// TODO: when other KSTAT_DATA_* types arrive, much of this will need to be restructured
|
||||||
if parts[1] == KSTAT_DATA_UINT64 {
|
if parts[1] == kstatDataUint64 {
|
||||||
key := fmt.Sprintf("kstat.zfs.misc.%s.%s", fmtExt, parts[0])
|
key := fmt.Sprintf("kstat.zfs.misc.%s.%s", fmtExt, parts[0])
|
||||||
value, err := strconv.ParseUint(parts[2], 10, 64)
|
value, err := strconv.ParseUint(parts[2], 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue