diff --git a/VERSION b/VERSION index 6c6aa7c..17e51c3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.0 \ No newline at end of file +0.1.1 diff --git a/collector/main.go b/collector/main.go index fb59f74..01044aa 100644 --- a/collector/main.go +++ b/collector/main.go @@ -92,7 +92,7 @@ func (b *mainCollector) Collect(ch chan<- prometheus.Metric) { err := b.fetchStatsEndpoint() if err != nil { ch <- prometheus.MustNewConstMetric(b.targetUp, prometheus.GaugeValue, float64(0)) // set target down - log.Errorf("Failed getting /stats endpoint of target") + log.Errorf("Failed getting /stats endpoint of target: " + err.Error()) return } diff --git a/collector/registrar.go b/collector/registrar.go index 83100ee..b68b4b2 100644 --- a/collector/registrar.go +++ b/collector/registrar.go @@ -6,7 +6,11 @@ import ( //Registrar json structure type Registrar struct { - Writes float64 `json:"writes"` + Writes struct { + Fail float64 `json:"fail"` + Success float64 `json:"success"` + Total float64 `json:"total"` + } `json:"writes"` States struct { Cleanup float64 `json:"cleanup"` Current float64 `json:"current"` @@ -30,10 +34,28 @@ func NewRegistrarCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collecto desc: prometheus.NewDesc( prometheus.BuildFQName(beatInfo.Beat, "registrar", "writes"), "registrar.writes", - nil, nil, + nil, prometheus.Labels{"writes": "fail"}, ), - eval: func(stats *Stats) float64 { return stats.Registrar.Writes }, - valType: prometheus.CounterValue, + eval: func(stats *Stats) float64 { return stats.Registrar.Writes.Fail }, + valType: prometheus.GaugeValue, + }, + { + desc: prometheus.NewDesc( + prometheus.BuildFQName(beatInfo.Beat, "registrar", "writes"), + "registrar.writes", + nil, prometheus.Labels{"writes": "success"}, + ), + eval: func(stats *Stats) float64 { return stats.Registrar.Writes.Success }, + valType: prometheus.GaugeValue, + }, + { + desc: prometheus.NewDesc( + prometheus.BuildFQName(beatInfo.Beat, "registrar", "writes"), + "registrar.writes", + nil, prometheus.Labels{"writes": "total"}, + ), + eval: func(stats *Stats) float64 { return stats.Registrar.Writes.Total }, + valType: prometheus.GaugeValue, }, { desc: prometheus.NewDesc(