MCPcopy Index your code
hub / github.com/coder/coder / callback

Method callback

agent/stats.go:54–68  ·  view source on GitHub ↗
(_, _ time.Time, virtual, _ map[netlogtype.Connection]netlogtype.Counts)

Source from the content-addressed store, hash-verified

52}
53
54func (s *statsReporter) callback(_, _ time.Time, virtual, _ map[netlogtype.Connection]netlogtype.Counts) {
55 s.L.Lock()
56 defer s.L.Unlock()
57 s.logger.Debug(context.Background(), "got stats callback")
58 // Accumulate stats until they've been reported.
59 if s.unreported && len(s.networkStats) > 0 {
60 for k, v := range virtual {
61 s.networkStats[k] = s.networkStats[k].Add(v)
62 }
63 } else {
64 s.networkStats = maps.Clone(virtual)
65 s.unreported = true
66 }
67 s.Broadcast()
68}
69
70// reportLoop programs the source (tailnet.Conn) to send it stats via the
71// callback, then reports them to the dest.

Callers 5

coordinationTestFunction · 0.80
syncReplicasMethod · 0.80
simulateResizeMethod · 0.80
doneMethod · 0.80
TestStatsReporterFunction · 0.80

Calls 4

AddMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45
CloneMethod · 0.45

Tested by 3

coordinationTestFunction · 0.64
simulateResizeMethod · 0.64
TestStatsReporterFunction · 0.64