MCPcopy
hub / github.com/grafana/tempo / publishWithDuration

Function publishWithDuration

pkg/hedgedmetrics/metrics.go:38–50  ·  view source on GitHub ↗
(s statsProvider, counter prometheus.Counter, duration time.Duration)

Source from the content-addressed store, hash-verified

36}
37
38func 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}

Callers 2

TestPublishFunction · 0.85
PublishFunction · 0.85

Calls 2

addAbsoluteToCounterMethod · 0.95
SnapshotMethod · 0.65

Tested by 1

TestPublishFunction · 0.68