diff options
Diffstat (limited to 'client/go/internal/vespa/document/stats.go')
-rw-r--r-- | client/go/internal/vespa/document/stats.go | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/client/go/internal/vespa/document/stats.go b/client/go/internal/vespa/document/stats.go index 82630b4af1c..9ce10f2f250 100644 --- a/client/go/internal/vespa/document/stats.go +++ b/client/go/internal/vespa/document/stats.go @@ -40,16 +40,29 @@ func (r Result) Success() bool { // Stats represents feeding operation statistics. type Stats struct { + // Number of operations passed to the feeder by the user, not counting retries. + Operations int64 + // Number of responses received, grouped by the HTTP status code. Requests that do not receive a response (i.e. no + // status code) are not counted. ResponsesByCode map[int]int64 - Requests int64 - Responses int64 - Errors int64 - Inflight int64 - TotalLatency time.Duration - MinLatency time.Duration - MaxLatency time.Duration - BytesSent int64 - BytesRecv int64 + // Number of requests made, including retries. + Requests int64 + // Number of responses received. + Responses int64 + // Number of transport layer errors. + Errors int64 + // Number of requests currently in-flight. + Inflight int64 + // Sum of response latency + TotalLatency time.Duration + // Lowest recorded response latency + MinLatency time.Duration + // Highest recorded response latency + MaxLatency time.Duration + // Total bytes sent + BytesSent int64 + // Total bytes received + BytesRecv int64 } // AvgLatency returns the average latency for a request. @@ -82,14 +95,16 @@ func (s Stats) Clone() Stats { } // Add statistics from result to this. -func (s *Stats) Add(result Result) { +func (s *Stats) Add(result Result, retry bool) { + if !retry { + s.Operations++ + } s.Requests++ if s.ResponsesByCode == nil { s.ResponsesByCode = make(map[int]int64) } if result.Err == nil { - responsesByCode := s.ResponsesByCode[result.HTTPStatus] - s.ResponsesByCode[result.HTTPStatus] = responsesByCode + 1 + s.ResponsesByCode[result.HTTPStatus]++ s.Responses++ } else { s.Errors++ |