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

Method Ready

pkg/util/trace_info.go:87–99  ·  view source on GitHub ↗
(now time.Time, writeBackoff, longWriteBackoff time.Duration)

Source from the content-addressed store, hash-verified

85}
86
87func (t *TraceInfo) Ready(now time.Time, writeBackoff, longWriteBackoff time.Duration) bool {
88 // Don't use the last time interval to allow the write loop to finish before
89 // we try to read it.
90 if t.timestamp.After(now.Add(-writeBackoff)) {
91 return false
92 }
93
94 // Compare a new instance with the same timestamp to know how many longWritesRemaining.
95 totalWrites := NewTraceInfo(t.timestamp, t.tempoOrgID).longWritesRemaining
96 // We are not ready if not all writes have had a chance to send.
97 lastWrite := t.timestamp.Add(time.Duration(totalWrites) * longWriteBackoff)
98 return !now.Before(lastWrite.Add(longWriteBackoff))
99}
100
101func (t *TraceInfo) Timestamp() time.Time {
102 return t.timestamp

Callers 2

TestTraceInfoFunction · 0.95
traceIsReadyFunction · 0.80

Calls 3

NewTraceInfoFunction · 0.85
DurationMethod · 0.80
AddMethod · 0.65

Tested by 1

TestTraceInfoFunction · 0.76