From 8df58c051fa4c8d71424d8a90cf6bf5d66d86697 Mon Sep 17 00:00:00 2001 From: Holger Obermaier <40787752+ho-ob@users.noreply.github.com> Date: Sat, 29 Jan 2022 10:04:31 +0100 Subject: [PATCH] Lower minimum required golang version to 1.16. --- collectors/gpfsMetric.go | 15 +++++++++++---- go.mod | 9 +-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/collectors/gpfsMetric.go b/collectors/gpfsMetric.go index bc1852b..53db1c2 100644 --- a/collectors/gpfsMetric.go +++ b/collectors/gpfsMetric.go @@ -130,14 +130,21 @@ func (m *GpfsCollector) Read(interval time.Duration, output chan lp.CCMetric) { continue } - timestampInt, err := strconv.ParseInt(key_value["_t_"]+key_value["_tu_"], 10, 64) - timestamp := time.UnixMicro(timestampInt) + sec, err := strconv.ParseInt(key_value["_t_"], 10, 64) if err != nil { fmt.Fprintf(os.Stderr, - "GpfsCollector.Read(): Failed to convert time stamp '%s': %s\n", - key_value["_t_"]+key_value["_tu_"], err.Error()) + "GpfsCollector.Read(): Failed to convert seconds to int '%s': %v\n", + key_value["_t_"], err) continue } + msec, err := strconv.ParseInt(key_value["_tu_"], 10, 64) + if err != nil { + fmt.Fprintf(os.Stderr, + "GpfsCollector.Read(): Failed to convert micro seconds to int '%s': %v\n", + key_value["_tu_"], err) + continue + } + timestamp := time.Unix(sec, msec*1000) // bytes read bytesRead, err := strconv.ParseInt(key_value["_br_"], 10, 64) diff --git a/go.mod b/go.mod index da4f3ea..0789f7e 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/ClusterCockpit/cc-metric-collector -go 1.17 +go 1.16 require ( github.com/NVIDIA/go-nvml v0.11.1-0 @@ -12,14 +12,7 @@ require ( ) require ( - github.com/deepmap/oapi-codegen v1.8.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/nats-io/nats-server/v2 v2.7.0 // indirect - github.com/nats-io/nkeys v0.3.0 // indirect - github.com/nats-io/nuid v1.0.1 // indirect - github.com/pkg/errors v0.9.1 // indirect - golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce // indirect - golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect google.golang.org/protobuf v1.27.1 // indirect - gopkg.in/yaml.v2 v2.3.0 // indirect )