forked from elastic/apm-agent-go
/
stats.go
33 lines (29 loc) · 929 Bytes
/
stats.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package elasticapm
// TracerStats holds statistics for a Tracer.
type TracerStats struct {
Errors TracerStatsErrors
ErrorsSent uint64
ErrorsDropped uint64
TransactionsSent uint64
TransactionsDropped uint64
}
// TracerStatsErrors holds error statistics for a Tracer.
type TracerStatsErrors struct {
SetContext uint64
SendTransactions uint64
SendErrors uint64
}
func (s TracerStats) isZero() bool {
return s == TracerStats{}
}
// accumulate updates the stats by accumulating them with
// the values in rhs.
func (s *TracerStats) accumulate(rhs TracerStats) {
s.Errors.SetContext += rhs.Errors.SetContext
s.Errors.SendTransactions += rhs.Errors.SendTransactions
s.Errors.SendErrors += rhs.Errors.SendErrors
s.ErrorsSent += rhs.ErrorsSent
s.ErrorsDropped += rhs.ErrorsDropped
s.TransactionsSent += rhs.TransactionsSent
s.TransactionsDropped += rhs.TransactionsDropped
}