From e60d822fa2bd0680d922ae5abc16e10c226c30f9 Mon Sep 17 00:00:00 2001 From: Hector Date: Mon, 30 Aug 2021 16:56:09 +0100 Subject: [PATCH] rename deprecated collector functions --- src/exporter.go | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/exporter.go b/src/exporter.go index 41f3619..5ca325f 100644 --- a/src/exporter.go +++ b/src/exporter.go @@ -117,11 +117,11 @@ func (e *Exporter) Describe(ch chan<- *prometheus.Desc) { func (e *Exporter) Collect(ch chan<- prometheus.Metric) { if e.db != nil { - e.collectBadIpsPerJailMetrics(ch) - e.collectBannedIpsPerJailMetrics(ch) - e.collectEnabledJailMetrics(ch) - e.collectUpMetric(ch) - e.collectErrorCountMetric(ch) + e.collectDeprecatedBadIpsPerJailMetrics(ch) + e.collectDeprecatedBannedIpsPerJailMetrics(ch) + e.collectDeprecatedEnabledJailMetrics(ch) + e.collectDeprecatedUpMetric(ch) + e.collectDeprecatedErrorCountMetric(ch) } if e.socketPath != "" { s, err := socket.ConnectToSocket(e.socketPath) @@ -136,10 +136,10 @@ func (e *Exporter) Collect(ch chan<- prometheus.Metric) { e.collectJailMetrics(ch, s) } } - e.collectErrorCountMetricNew(ch) + e.collectErrorCountMetric(ch) } -func (e *Exporter) collectUpMetric(ch chan<- prometheus.Metric) { +func (e *Exporter) collectDeprecatedUpMetric(ch chan<- prometheus.Metric) { var upMetricValue float64 = 1 if e.lastError != nil { upMetricValue = 0 @@ -149,13 +149,13 @@ func (e *Exporter) collectUpMetric(ch chan<- prometheus.Metric) { ) } -func (e *Exporter) collectErrorCountMetric(ch chan<- prometheus.Metric) { +func (e *Exporter) collectDeprecatedErrorCountMetric(ch chan<- prometheus.Metric) { ch <- prometheus.MustNewConstMetric( deprecatedMetricErrorCount, prometheus.CounterValue, float64(e.dbErrorCount), "db", ) } -func (e *Exporter) collectBadIpsPerJailMetrics(ch chan<- prometheus.Metric) { +func (e *Exporter) collectDeprecatedBadIpsPerJailMetrics(ch chan<- prometheus.Metric) { jailNameToCountMap, err := e.db.CountBadIpsPerJail() e.lastError = err @@ -171,7 +171,7 @@ func (e *Exporter) collectBadIpsPerJailMetrics(ch chan<- prometheus.Metric) { } } -func (e *Exporter) collectBannedIpsPerJailMetrics(ch chan<- prometheus.Metric) { +func (e *Exporter) collectDeprecatedBannedIpsPerJailMetrics(ch chan<- prometheus.Metric) { jailNameToCountMap, err := e.db.CountBannedIpsPerJail() e.lastError = err @@ -187,7 +187,7 @@ func (e *Exporter) collectBannedIpsPerJailMetrics(ch chan<- prometheus.Metric) { } } -func (e *Exporter) collectEnabledJailMetrics(ch chan<- prometheus.Metric) { +func (e *Exporter) collectDeprecatedEnabledJailMetrics(ch chan<- prometheus.Metric) { jailNameToEnabledMap, err := e.db.JailNameToEnabledValue() e.lastError = err @@ -203,15 +203,15 @@ func (e *Exporter) collectEnabledJailMetrics(ch chan<- prometheus.Metric) { } } -func (e *Exporter) collectErrorCountMetricNew(ch chan<- prometheus.Metric) { +func (e *Exporter) collectErrorCountMetric(ch chan<- prometheus.Metric) { ch <- prometheus.MustNewConstMetric( metricErrorCount, prometheus.CounterValue, float64(e.dbErrorCount), "db", ) ch <- prometheus.MustNewConstMetric( - metricErrorCountNew, prometheus.CounterValue, float64(e.socketConnectionErrorCount), "socket_conn", + metricErrorCount, prometheus.CounterValue, float64(e.socketConnectionErrorCount), "socket_conn", ) ch <- prometheus.MustNewConstMetric( - metricErrorCountNew, prometheus.CounterValue, float64(e.socketRequestErrorCount), "socket_req", + metricErrorCount, prometheus.CounterValue, float64(e.socketRequestErrorCount), "socket_req", ) }