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

Function selectPastTimestamp

cmd/tempo-vulture/main.go:457–469  ·  view source on GitHub ↗
(start, stop time.Time, interval, retention time.Duration, r *rand.Rand)

Source from the content-addressed store, hash-verified

455}
456
457func selectPastTimestamp(start, stop time.Time, interval, retention time.Duration, r *rand.Rand) (newStart, ts time.Time) {
458 oldest := stop.Add(-retention)
459
460 if oldest.After(start) {
461 newStart = oldest
462 } else {
463 newStart = start
464 }
465
466 ts = time.Unix(generateRandomInt(newStart.Unix(), stop.Unix(), r), 0)
467
468 return newStart.Round(interval), ts.Round(interval)
469}
470
471func generateRandomInt(minVal, maxVal int64, r *rand.Rand) int64 {
472 minVal++

Callers 2

mainFunction · 0.85
runCheckerFunction · 0.85

Calls 2

generateRandomIntFunction · 0.85
AddMethod · 0.65

Tested by

no test coverage detected