MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / reportDbStats

Method reportDbStats

rest/handler.go:841–853  ·  view source on GitHub ↗

reportDbStats will report the public rest request specific stats back to the database

()

Source from the content-addressed store, hash-verified

839
840// reportDbStats will report the public rest request specific stats back to the database
841func (h *handler) reportDbStats() {
842 if !h.shouldUpdateBytesTransferredStats() {
843 return
844 }
845 var bytesReadStat int64
846 h.response.reportStats(true)
847 // load the number of bytes read on the request
848 bytesReadStat = h.requestBody.GetBodyBytesCount()
849 // as this is int64 lets protect against a situation where a negative is returned from GetBodyBytesCount() function and thus decrementing the stat
850 if bytesReadStat > 0 {
851 h.db.DbStats.DatabaseStats.PublicRestBytesRead.Add(bytesReadStat)
852 }
853}
854
855// logStatusWithDuration will log the request status and the duration of the request.
856func (h *handler) logStatusWithDuration(status int, message string) {

Callers 1

makeHandlerWithOptionsFunction · 0.80

Calls 4

GetBodyBytesCountMethod · 0.80
reportStatsMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected