-
Notifications
You must be signed in to change notification settings - Fork 140
/
stats.go
50 lines (44 loc) · 1.32 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package types
// Stats provides zipper-related statistics
type Stats struct {
Timeouts uint64
FindRequests uint64
FindErrors uint64
FindTimeouts uint64
RenderRequests uint64
RenderErrors uint64
RenderTimeouts uint64
InfoRequests uint64
InfoErrors uint64
InfoTimeouts uint64
SearchRequests uint64
SearchCacheHits uint64
SearchCacheMisses uint64
ZipperRequests uint64
TotalMetricsCount uint64
MemoryUsage int64
CacheMisses uint64
CacheHits uint64
Servers []string
FailedServers []string
}
func (s *Stats) Merge(stats *Stats) {
s.Timeouts += stats.Timeouts
s.FindRequests += stats.FindRequests
s.FindTimeouts += stats.FindTimeouts
s.FindErrors += stats.FindErrors
s.RenderRequests += stats.RenderRequests
s.RenderTimeouts += stats.RenderTimeouts
s.RenderErrors += stats.RenderErrors
s.InfoRequests += stats.InfoRequests
s.InfoTimeouts += stats.InfoTimeouts
s.InfoErrors += stats.InfoErrors
s.SearchRequests += stats.SearchRequests
s.SearchCacheHits += stats.SearchCacheHits
s.SearchCacheMisses += stats.SearchCacheMisses
s.MemoryUsage += stats.MemoryUsage
s.CacheMisses += stats.CacheMisses
s.CacheHits += stats.CacheHits
s.Servers = append(s.Servers, stats.Servers...)
s.FailedServers = append(s.FailedServers, stats.FailedServers...)
}