MM-21922: Add metrics for http verb (#13679)
* MM-21922: Add metrics for http verb * Use multiple params Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
815e6b5956
Коммит
11d15107b0
@@ -43,8 +43,8 @@ type MetricsInterface interface {
|
|||||||
|
|
||||||
IncrementPostsSearchCounter()
|
IncrementPostsSearchCounter()
|
||||||
ObservePostsSearchDuration(elapsed float64)
|
ObservePostsSearchDuration(elapsed float64)
|
||||||
ObserveStoreMethodDuration(method string, success string, elapsed float64)
|
ObserveStoreMethodDuration(method, success string, elapsed float64)
|
||||||
ObserveApiEndpointDuration(endpoint string, elapsed float64)
|
ObserveApiEndpointDuration(endpoint, method string, elapsed float64)
|
||||||
IncrementPostIndexCounter()
|
IncrementPostIndexCounter()
|
||||||
IncrementUserIndexCounter()
|
IncrementUserIndexCounter()
|
||||||
IncrementChannelIndexCounter()
|
IncrementChannelIndexCounter()
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
if r.URL.Path != model.API_URL_SUFFIX+"/websocket" {
|
if r.URL.Path != model.API_URL_SUFFIX+"/websocket" {
|
||||||
elapsed := float64(time.Since(now)) / float64(time.Second)
|
elapsed := float64(time.Since(now)) / float64(time.Second)
|
||||||
c.App.Metrics.ObserveHttpRequestDuration(elapsed)
|
c.App.Metrics.ObserveHttpRequestDuration(elapsed)
|
||||||
c.App.Metrics.ObserveApiEndpointDuration(h.HandlerName, elapsed)
|
c.App.Metrics.ObserveApiEndpointDuration(h.HandlerName, r.Method, elapsed)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user