Function
publishWithDuration
(s statsProvider, counter prometheus.Counter, duration time.Duration)
Source from the content-addressed store, hash-verified
| 36 | } |
| 37 | |
| 38 | func publishWithDuration(s statsProvider, counter prometheus.Counter, duration time.Duration) { |
| 39 | ticker := time.NewTicker(duration) |
| 40 | diff := &diffCounter{previous: 0, counter: counter} |
| 41 | |
| 42 | go func() { |
| 43 | for range ticker.C { |
| 44 | snap := s.Snapshot() |
| 45 | |
| 46 | hedgedRequests := snap.ActualRoundTrips - snap.RequestedRoundTrips |
| 47 | diff.addAbsoluteToCounter(hedgedRequests) |
| 48 | } |
| 49 | }() |
| 50 | } |