rename deprecated collector functions
This commit is contained in:
parent
2ff6d64007
commit
e60d822fa2
@ -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",
|
||||
)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user