MCPcopy
hub / github.com/grpc/grpc-go / merge

Method merge

balancer/grpclb/grpclb_test.go:145–155  ·  view source on GitHub ↗

merge merges the new client stats into current stats. It's a test-only method. rpcStats is defined in grpclb_picker.

(cs *lbpb.ClientStats)

Source from the content-addressed store, hash-verified

143//
144// It's a test-only method. rpcStats is defined in grpclb_picker.
145func (s *rpcStats) merge(cs *lbpb.ClientStats) {
146 atomic.AddInt64(&s.numCallsStarted, cs.NumCallsStarted)
147 atomic.AddInt64(&s.numCallsFinished, cs.NumCallsFinished)
148 atomic.AddInt64(&s.numCallsFinishedWithClientFailedToSend, cs.NumCallsFinishedWithClientFailedToSend)
149 atomic.AddInt64(&s.numCallsFinishedKnownReceived, cs.NumCallsFinishedKnownReceived)
150 s.mu.Lock()
151 for _, perToken := range cs.CallsFinishedWithDrop {
152 s.numCallsDropped[perToken.LoadBalanceToken] += perToken.NumCalls
153 }
154 s.mu.Unlock()
155}
156
157func atomicEqual(a, b *int64) bool {
158 return atomic.LoadInt64(a) == atomic.LoadInt64(b)

Callers 1

BalanceLoadMethod · 0.45

Calls 2

LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected