From 94fae3b215221ba4c1086c00b26eba0d8c51d34d Mon Sep 17 00:00:00 2001 From: KAcper Perschke Date: Sun, 10 Dec 2023 04:01:55 +0100 Subject: [PATCH] Please consider some cosmetic changes. (#120) --- artifactory/client.go | 1 + artifactory_exporter.go | 5 +++-- collector/exporter.go | 3 ++- collector/openMetrics.go | 6 +++--- collector/security.go | 3 ++- collector/storage.go | 3 ++- collector/system.go | 3 ++- go.mod | 2 +- 8 files changed, 16 insertions(+), 10 deletions(-) diff --git a/artifactory/client.go b/artifactory/client.go index da547ee..55df691 100644 --- a/artifactory/client.go +++ b/artifactory/client.go @@ -5,6 +5,7 @@ import ( "net/http" "github.com/go-kit/log" + "github.com/peimanja/artifactory_exporter/config" ) diff --git a/artifactory_exporter.go b/artifactory_exporter.go index 7beec0b..9a754ba 100644 --- a/artifactory_exporter.go +++ b/artifactory_exporter.go @@ -6,12 +6,13 @@ import ( "os" "github.com/go-kit/log/level" - "github.com/peimanja/artifactory_exporter/collector" - "github.com/peimanja/artifactory_exporter/config" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/common/log" "github.com/prometheus/common/version" + + "github.com/peimanja/artifactory_exporter/collector" + "github.com/peimanja/artifactory_exporter/config" ) func main() { diff --git a/collector/exporter.go b/collector/exporter.go index 38e810d..638db63 100644 --- a/collector/exporter.go +++ b/collector/exporter.go @@ -4,9 +4,10 @@ import ( "sync" "github.com/go-kit/log" + "github.com/prometheus/client_golang/prometheus" + "github.com/peimanja/artifactory_exporter/artifactory" "github.com/peimanja/artifactory_exporter/config" - "github.com/prometheus/client_golang/prometheus" ) // Exporter collects JFrog Artifactory stats from the given URI and diff --git a/collector/openMetrics.go b/collector/openMetrics.go index 97a443e..d6727b9 100644 --- a/collector/openMetrics.go +++ b/collector/openMetrics.go @@ -5,7 +5,7 @@ import ( "github.com/go-kit/log/level" "github.com/prometheus/client_golang/prometheus" - io_prometheus_client "github.com/prometheus/client_model/go" + ioPrometheusClient "github.com/prometheus/client_model/go" "github.com/prometheus/common/expfmt" ) @@ -48,9 +48,9 @@ func (e *Exporter) exportOpenMetrics(ch chan<- prometheus.Metric) error { // create a new metric and collect it switch family.GetType() { - case io_prometheus_client.MetricType_COUNTER: + case ioPrometheusClient.MetricType_COUNTER: ch <- prometheus.MustNewConstMetric(desc, prometheus.CounterValue, metric.GetCounter().GetValue()) - case io_prometheus_client.MetricType_GAUGE: + case ioPrometheusClient.MetricType_GAUGE: ch <- prometheus.MustNewConstMetric(desc, prometheus.GaugeValue, metric.GetGauge().GetValue()) } } diff --git a/collector/security.go b/collector/security.go index caa6caf..343964a 100644 --- a/collector/security.go +++ b/collector/security.go @@ -4,8 +4,9 @@ import ( "fmt" "github.com/go-kit/log/level" - "github.com/peimanja/artifactory_exporter/artifactory" "github.com/prometheus/client_golang/prometheus" + + "github.com/peimanja/artifactory_exporter/artifactory" ) type user struct { diff --git a/collector/storage.go b/collector/storage.go index 5bd958c..d8750f2 100644 --- a/collector/storage.go +++ b/collector/storage.go @@ -4,8 +4,9 @@ import ( "strings" "github.com/go-kit/log/level" - "github.com/peimanja/artifactory_exporter/artifactory" "github.com/prometheus/client_golang/prometheus" + + "github.com/peimanja/artifactory_exporter/artifactory" ) const calculateValueError = "There was an issue calculating the value" diff --git a/collector/system.go b/collector/system.go index 8b3f518..d7c3cb9 100644 --- a/collector/system.go +++ b/collector/system.go @@ -5,8 +5,9 @@ import ( "time" "github.com/go-kit/log/level" - "github.com/peimanja/artifactory_exporter/artifactory" "github.com/prometheus/client_golang/prometheus" + + "github.com/peimanja/artifactory_exporter/artifactory" ) func (e *Exporter) exportSystem(license artifactory.LicenseInfo, ch chan<- prometheus.Metric) error { diff --git a/go.mod b/go.mod index 6651209..02b58bc 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( github.com/go-kit/log v0.1.0 github.com/kelseyhightower/envconfig v1.4.0 github.com/prometheus/client_golang v1.11.1 + github.com/prometheus/client_model v0.2.0 github.com/prometheus/common v0.26.0 gopkg.in/alecthomas/kingpin.v2 v2.2.6 ) @@ -20,7 +21,6 @@ require ( github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/procfs v0.6.0 // indirect github.com/sirupsen/logrus v1.6.0 // indirect golang.org/x/sys v0.2.0 // indirect