Compare commits

..

No commits in common. "peersTotal" and "master" have entirely different histories.

View file

@ -77,7 +77,6 @@ type PrometheusExporter struct {
txErrorPackets *prometheus.Desc txErrorPackets *prometheus.Desc
txErrorBytes *prometheus.Desc txErrorBytes *prometheus.Desc
peersTotal *prometheus.Desc
peersUpTotal *prometheus.Desc peersUpTotal *prometheus.Desc
peerUp *prometheus.Desc peerUp *prometheus.Desc
@ -127,7 +126,6 @@ func NewPrometheusExporter(ifName string, sockName string) PrometheusExporter {
txErrorPackets: prometheus.NewDesc(c("tx_error_packets"), "tx error packets count", nil, l), txErrorPackets: prometheus.NewDesc(c("tx_error_packets"), "tx error packets count", nil, l),
txErrorBytes: prometheus.NewDesc(c("tx_error_bytes"), "tx error bytes count", nil, l), txErrorBytes: prometheus.NewDesc(c("tx_error_bytes"), "tx error bytes count", nil, l),
peersTotal: prometheus.NewDesc(c("peers_total"), "number of peers", nil, l),
peersUpTotal: prometheus.NewDesc(c("peers_up_total"), "number of connected peers", nil, l), peersUpTotal: prometheus.NewDesc(c("peers_up_total"), "number of connected peers", nil, l),
// per peer metrics // per peer metrics
@ -162,7 +160,6 @@ func (e PrometheusExporter) Describe(c chan<- *prometheus.Desc) {
c <- e.txDroppedPackets c <- e.txDroppedPackets
c <- e.txDroppedBytes c <- e.txDroppedBytes
c <- e.peersTotal
c <- e.peersUpTotal c <- e.peersUpTotal
c <- e.peerUp c <- e.peerUp
@ -202,11 +199,9 @@ func (e PrometheusExporter) Collect(c chan<- prometheus.Metric) {
c <- prometheus.MustNewConstMetric(e.txDroppedPackets, prometheus.CounterValue, float64(data.Statistics.TX.Count)) c <- prometheus.MustNewConstMetric(e.txDroppedPackets, prometheus.CounterValue, float64(data.Statistics.TX.Count))
c <- prometheus.MustNewConstMetric(e.txDroppedBytes, prometheus.CounterValue, float64(data.Statistics.TX_Dropped.Bytes)) c <- prometheus.MustNewConstMetric(e.txDroppedBytes, prometheus.CounterValue, float64(data.Statistics.TX_Dropped.Bytes))
peersTotal := 0
peersUpTotal := 0 peersUpTotal := 0
for publicKey, peer := range data.Peers { for publicKey, peer := range data.Peers {
peersTotal += 1
if peer.Connection != nil { if peer.Connection != nil {
peersUpTotal += 1 peersUpTotal += 1
} }
@ -233,7 +228,6 @@ func (e PrometheusExporter) Collect(c chan<- prometheus.Metric) {
} }
} }
c <- prometheus.MustNewConstMetric(e.peersTotal, prometheus.GaugeValue, float64(peersTotal))
c <- prometheus.MustNewConstMetric(e.peersUpTotal, prometheus.GaugeValue, float64(peersUpTotal)) c <- prometheus.MustNewConstMetric(e.peersUpTotal, prometheus.GaugeValue, float64(peersUpTotal))
} }