From d5a615b8c9a469c88bebec7294d0ae0c9931773a Mon Sep 17 00:00:00 2001 From: Honglin Feng Date: Fri, 15 Feb 2019 21:55:08 +0800 Subject: [PATCH] update the event number Signed-off-by: Honglin Feng --- notifications/metrics.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/notifications/metrics.go b/notifications/metrics.go index 4464edd8..3b43c51f 100644 --- a/notifications/metrics.go +++ b/notifications/metrics.go @@ -77,7 +77,7 @@ func (emsl *endpointMetricsHTTPStatusListener) success(status int, events ...Eve emsl.Successes += len(events) statusCounter.WithValues(fmt.Sprintf("%d %s", status, http.StatusText(status)), emsl.EndpointName).Inc(1) - eventsCounter.WithValues("Successes", emsl.EndpointName).Inc(1) + eventsCounter.WithValues("Successes", emsl.EndpointName).Inc(float64(len(events))) } func (emsl *endpointMetricsHTTPStatusListener) failure(status int, events ...Event) { @@ -87,7 +87,7 @@ func (emsl *endpointMetricsHTTPStatusListener) failure(status int, events ...Eve emsl.Failures += len(events) statusCounter.WithValues(fmt.Sprintf("%d %s", status, http.StatusText(status)), emsl.EndpointName).Inc(1) - eventsCounter.WithValues("Failures", emsl.EndpointName).Inc(1) + eventsCounter.WithValues("Failures", emsl.EndpointName).Inc(float64(len(events))) } func (emsl *endpointMetricsHTTPStatusListener) err(err error, events ...Event) { @@ -95,7 +95,7 @@ func (emsl *endpointMetricsHTTPStatusListener) err(err error, events ...Event) { defer emsl.safeMetrics.Unlock() emsl.Errors += len(events) - eventsCounter.WithValues("Errors", emsl.EndpointName).Inc(1) + eventsCounter.WithValues("Errors", emsl.EndpointName).Inc(float64(len(events))) } // endpointMetricsEventQueueListener maintains the incoming events counter and @@ -111,7 +111,7 @@ func (eqc *endpointMetricsEventQueueListener) ingress(events ...Event) { eqc.Pending += len(events) eventsCounter.WithValues("Events", eqc.EndpointName).Inc() - pendingGauge.WithValues(eqc.EndpointName).Inc(1) + pendingGauge.WithValues(eqc.EndpointName).Inc(float64(len(events))) } func (eqc *endpointMetricsEventQueueListener) egress(events ...Event) {