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

Function pagesPerRequest

modules/frontend/search_sharder.go:381–401  ·  view source on GitHub ↗

pagesPerRequest returns an integer value that indicates the number of pages that should be searched per query. This value is based on the target number of bytes 0 is returned if there is no valid answer

(m *backend.BlockMeta, bytesPerRequest int)

Source from the content-addressed store, hash-verified

379// that should be searched per query. This value is based on the target number of bytes
380// 0 is returned if there is no valid answer
381func pagesPerRequest(m *backend.BlockMeta, bytesPerRequest int) int {
382 if m.Size_ == 0 || m.TotalRecords == 0 {
383 return 0
384 }
385 // if the block is smaller than the bytesPerRequest, we can search the entire block
386 if m.Size_ < uint64(bytesPerRequest) {
387 return int(m.TotalRecords)
388 }
389
390 bytesPerPage := m.Size_ / uint64(m.TotalRecords)
391 if bytesPerPage == 0 {
392 return 0
393 }
394
395 pagesPerQuery := bytesPerRequest / int(bytesPerPage)
396 if pagesPerQuery == 0 {
397 pagesPerQuery = 1 // have to have at least 1 page per query
398 }
399
400 return pagesPerQuery
401}
402
403func buildIngesterRequest(tenantID string, parent pipeline.Request, searchReq *tempopb.SearchRequest, reqCh chan pipeline.Request) error {
404 subR, err := cloneRequestforQueriers(parent, tenantID, func(r *http.Request) (*http.Request, error) {

Callers 2

iterateTagJobsFunction · 0.85
backendJobsFuncFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected