forked from mirror/client_golang
Quick-fix the doc comment.
This commit is contained in:
parent
aa848f77db
commit
26e2417d3e
|
@ -47,23 +47,19 @@ func nowSeries(t ...time.Time) nower {
|
||||||
}
|
}
|
||||||
|
|
||||||
// InstrumentHandler wraps the given HTTP handler for instrumentation. It
|
// InstrumentHandler wraps the given HTTP handler for instrumentation. It
|
||||||
// registers four metric vector collectors (if not already done) and reports
|
// registers four metric collectors (if not already done) and reports http
|
||||||
// http metrics to the (newly or already) registered collectors:
|
// metrics to the (newly or already) registered collectors: http_requests_total
|
||||||
// http_requests_total (CounterVec), http_request_duration_microseconds
|
// (CounterVec), http_request_duration_microseconds (Summary),
|
||||||
// (SummaryVec), http_request_size_bytes (SummaryVec), http_response_size_bytes
|
// http_request_size_bytes (Summary), http_response_size_bytes (Summary). Each
|
||||||
// (SummaryVec). Each has three labels: handler, method, code. The value of the
|
// has a constant label named "handler" with the provided handlerName as
|
||||||
// handler label is set by the handlerName parameter of this function.
|
// value. http_requests_total is a metric vector partitioned by HTTP method
|
||||||
|
// (label name "method") and HTTP status code (label name "code").
|
||||||
func InstrumentHandler(handlerName string, handler http.Handler) http.HandlerFunc {
|
func InstrumentHandler(handlerName string, handler http.Handler) http.HandlerFunc {
|
||||||
return InstrumentHandlerFunc(handlerName, handler.ServeHTTP)
|
return InstrumentHandlerFunc(handlerName, handler.ServeHTTP)
|
||||||
}
|
}
|
||||||
|
|
||||||
// InstrumentHandlerFunc wraps the given function for instrumentation. It
|
// InstrumentHandlerFunc wraps the given function for instrumentation. It
|
||||||
// registers four metric vector collectors (if not already done) and reports
|
// otherwise works in the same way as InstrumentHandler.
|
||||||
// http metrics to the (newly or already) registered collectors:
|
|
||||||
// http_requests_total (CounterVec), http_request_duration_microseconds
|
|
||||||
// (SummaryVec), http_request_size_bytes (SummaryVec), http_response_size_bytes
|
|
||||||
// (SummaryVec). Each has three labels: handler, method, code. The value of the
|
|
||||||
// handler label is set by the handlerName parameter of this function.
|
|
||||||
func InstrumentHandlerFunc(handlerName string, handlerFunc func(http.ResponseWriter, *http.Request)) http.HandlerFunc {
|
func InstrumentHandlerFunc(handlerName string, handlerFunc func(http.ResponseWriter, *http.Request)) http.HandlerFunc {
|
||||||
return InstrumentHandlerFuncWithOpts(
|
return InstrumentHandlerFuncWithOpts(
|
||||||
SummaryOpts{
|
SummaryOpts{
|
||||||
|
@ -76,13 +72,13 @@ func InstrumentHandlerFunc(handlerName string, handlerFunc func(http.ResponseWri
|
||||||
|
|
||||||
// InstrumentHandlerWithOpts works like InstrumentHandler but provides more
|
// InstrumentHandlerWithOpts works like InstrumentHandler but provides more
|
||||||
// flexibility (at the cost of a more complex call syntax). As
|
// flexibility (at the cost of a more complex call syntax). As
|
||||||
// InstrumentHandler, this function registers four metric vector collectors, but
|
// InstrumentHandler, this function registers four metric collectors, but it
|
||||||
// it uses the provided SummaryOpts to create them. However, the fields "Name"
|
// uses the provided SummaryOpts to create them. However, the fields "Name" and
|
||||||
// and "Help" in the SummaryOpts are ignored. "Name" is replaced by
|
// "Help" in the SummaryOpts are ignored. "Name" is replaced by
|
||||||
// "requests_total", "request_duration_microseconds", "request_size_bytes", and
|
// "requests_total", "request_duration_microseconds", "request_size_bytes", and
|
||||||
// "response_size_bytes", respectively. "Help" is replaced by an appropriate
|
// "response_size_bytes", respectively. "Help" is replaced by an appropriate
|
||||||
// help string. The names of the variable labels of the vector collectors are
|
// help string. The names of the variable labels of the http_requests_total
|
||||||
// "method" (get, post, etc.), and "code" (HTTP status code).
|
// CounterVec are "method" (get, post, etc.), and "code" (HTTP status code).
|
||||||
//
|
//
|
||||||
// If InstrumentHandlerWithOpts is called as follows, it mimics exactly the
|
// If InstrumentHandlerWithOpts is called as follows, it mimics exactly the
|
||||||
// behavior of InstrumentHandler:
|
// behavior of InstrumentHandler:
|
||||||
|
|
Loading…
Reference in New Issue