Skip to content

Commit 3c65de0

Browse files
authored
Instrument response encoding time (#81)
1 parent c4e338c commit 3c65de0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

api/api_gomux.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,7 @@ func (api *API) getEntitiesHandler(w http.ResponseWriter, r *http.Request) {
585585
rc.gm.Val(metrics.ReadMatch, int64(len(entities)))
586586

587587
// Success: return matching entities (possibly empty list)
588+
rc.inst.Start("encode-response")
588589
if len(entities) > 0 && strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") {
589590
// use gzip compression if we have data to send back and the client accepts gzip
590591
w.Header().Set("Content-Encoding", "gzip")
@@ -595,6 +596,7 @@ func (api *API) getEntitiesHandler(w http.ResponseWriter, r *http.Request) {
595596
// no compression
596597
json.NewEncoder(w).Encode(entities)
597598
}
599+
rc.inst.Stop("encode-response")
598600
}
599601

600602
// //////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)