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

Function backendRange

modules/frontend/search_sharder.go:283–297  ·  view source on GitHub ↗

backendRange returns a new start/end range for the backend based on the config parameter query_backend_after. If the returned start == the returned end then backend querying is not necessary.

(start, end uint32, queryBackendAfter time.Duration)

Source from the content-addressed store, hash-verified

281// backendRange returns a new start/end range for the backend based on the config parameter
282// query_backend_after. If the returned start == the returned end then backend querying is not necessary.
283func backendRange(start, end uint32, queryBackendAfter time.Duration) (uint32, uint32) {
284 now := time.Now()
285 backendAfter := uint32(now.Add(-queryBackendAfter).Unix())
286
287 // adjust start/end if necessary. if the entire query range was inside backendAfter then
288 // start will == end. This signals we don't need to query the backend.
289 if end > backendAfter {
290 end = backendAfter
291 }
292 if start > backendAfter {
293 start = backendAfter
294 }
295
296 return start, end
297}
298
299// buildBackendRequests returns a slice of requests that cover all blocks in the store
300// that are covered by start/end.

Callers 3

TestBackendRangeFunction · 0.85
backendRequestsMethod · 0.85
backendRequestsMethod · 0.85

Calls 2

NowMethod · 0.65
AddMethod · 0.65

Tested by 1

TestBackendRangeFunction · 0.68