Fix label order for http_requests_total

- the order of http_requests_total was shown to be incorrect in
testing. This fixes the order as per
http_request_duration_seconds.

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis (VMware) 2019-01-24 09:46:14 +00:00
parent a26d350376
commit ec185bad67

View File

@ -25,7 +25,8 @@ type PrometheusServiceNotifier struct {
func (psn PrometheusServiceNotifier) Notify(method string, URL string, originalURL string, statusCode int, duration time.Duration) { func (psn PrometheusServiceNotifier) Notify(method string, URL string, originalURL string, statusCode int, duration time.Duration) {
code := fmt.Sprintf("%d", statusCode) code := fmt.Sprintf("%d", statusCode)
path := urlToLabel(URL) path := urlToLabel(URL)
psn.ServiceMetrics.Counter.WithLabelValues(code, method, path).Inc()
psn.ServiceMetrics.Counter.WithLabelValues(method, path, code).Inc()
psn.ServiceMetrics.Histogram.WithLabelValues(method, path, code).Observe(duration.Seconds()) psn.ServiceMetrics.Histogram.WithLabelValues(method, path, code).Observe(duration.Seconds())
} }