From 66b57abe53110971a76c55488c40da13f5e5cf8b Mon Sep 17 00:00:00 2001 From: Kobus Coetzer Date: Wed, 17 Jul 2019 08:14:44 +1000 Subject: [PATCH] Update request_time to be more resilient in case of a CouchDB configuration change --- lib/collector-v2.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/collector-v2.go b/lib/collector-v2.go index 972d611c..8f34582f 100644 --- a/lib/collector-v2.go +++ b/lib/collector-v2.go @@ -31,12 +31,10 @@ func (e *Exporter) collectV2(stats Stats, exposedHttpStatusCodes []string, colle e.requestTime.WithLabelValues(name, "StandardDeviation").Set(nodeStats.Couchdb.RequestTime.Value.StandardDeviation) e.requestTime.WithLabelValues(name, "Skewness").Set(nodeStats.Couchdb.RequestTime.Value.Skewness) e.requestTime.WithLabelValues(name, "Kurtosis").Set(nodeStats.Couchdb.RequestTime.Value.Kurtosis) - e.requestTime.WithLabelValues(name, "p50").Set(nodeStats.Couchdb.RequestTime.Value.Percentile[0][1]) - e.requestTime.WithLabelValues(name, "p75").Set(nodeStats.Couchdb.RequestTime.Value.Percentile[1][1]) - e.requestTime.WithLabelValues(name, "p90").Set(nodeStats.Couchdb.RequestTime.Value.Percentile[2][1]) - e.requestTime.WithLabelValues(name, "p95").Set(nodeStats.Couchdb.RequestTime.Value.Percentile[3][1]) - e.requestTime.WithLabelValues(name, "p99").Set(nodeStats.Couchdb.RequestTime.Value.Percentile[4][1]) - e.requestTime.WithLabelValues(name, "p999").Set(nodeStats.Couchdb.RequestTime.Value.Percentile[5][1]) + + for _, percentile := range nodeStats.Couchdb.RequestTime.Value.Percentile { + e.requestTime.WithLabelValues(name, fmt.Sprintf("%v", percentile[0])).Set(percentile[1]) + } for _, level := range exposedLogLevels { e.couchLog.WithLabelValues(level, name).Set(nodeStats.CouchLog.Level[level].Value)