Browse Source

proxy/httpproxy: document histogram

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
Gyuho Lee 7 years ago
parent
commit
1a102fb3f5
1 changed files with 7 additions and 5 deletions
  1. 7 5
      proxy/httpproxy/metrics.go

+ 7 - 5
proxy/httpproxy/metrics.go

@@ -47,13 +47,15 @@ var (
 			Help:      "Counter of requests dropped on the proxy.",
 		}, []string{"method", "proxying_error"})
 
-	requestsHandlingTime = prometheus.NewHistogramVec(
+	requestsHandlingSec = prometheus.NewHistogramVec(
 		prometheus.HistogramOpts{
 			Namespace: "etcd",
 			Subsystem: "proxy",
 			Name:      "handling_duration_seconds",
-			Help: "Bucketed histogram of handling time of successful events (non-watches), by method " +
-				"(GET/PUT etc.).",
+			Help:      "Bucketed histogram of handling time of successful events (non-watches), by method (GET/PUT etc.).",
+
+			// lowest bucket start of upper bound 0.0005 sec (0.5 ms) with factor 2
+			// highest bucket start of 0.0005 sec * 2^12 == 2.048 sec
 			Buckets: prometheus.ExponentialBuckets(0.0005, 2, 13),
 		}, []string{"method"})
 )
@@ -70,7 +72,7 @@ func init() {
 	prometheus.MustRegister(requestsIncoming)
 	prometheus.MustRegister(requestsHandled)
 	prometheus.MustRegister(requestsDropped)
-	prometheus.MustRegister(requestsHandlingTime)
+	prometheus.MustRegister(requestsHandlingSec)
 }
 
 func reportIncomingRequest(request *http.Request) {
@@ -80,7 +82,7 @@ func reportIncomingRequest(request *http.Request) {
 func reportRequestHandled(request *http.Request, response *http.Response, startTime time.Time) {
 	method := request.Method
 	requestsHandled.WithLabelValues(method, strconv.Itoa(response.StatusCode)).Inc()
-	requestsHandlingTime.WithLabelValues(method).Observe(time.Since(startTime).Seconds())
+	requestsHandlingSec.WithLabelValues(method).Observe(time.Since(startTime).Seconds())
 }
 
 func reportRequestDropped(request *http.Request, err forwardingError) {