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

Function nextReport

pkg/usagestats/reporter.go:311–314  ·  view source on GitHub ↗

nextReport compute the next report time based on the interval. The interval is based off the creation of the cluster seed to avoid all cluster reporting at the same time.

(interval time.Duration, createdAt, now time.Time)

Source from the content-addressed store, hash-verified

309// nextReport compute the next report time based on the interval.
310// The interval is based off the creation of the cluster seed to avoid all cluster reporting at the same time.
311func nextReport(interval time.Duration, createdAt, now time.Time) time.Time {
312 // createdAt * (x * interval ) >= now
313 return createdAt.Add(time.Duration(math.Ceil(float64(now.Sub(createdAt))/float64(interval))) * interval)
314}

Callers 2

runningMethod · 0.85
Test_NextReportFunction · 0.85

Calls 2

DurationMethod · 0.80
AddMethod · 0.65

Tested by 1

Test_NextReportFunction · 0.68