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

Method AddShards

modules/frontend/shardtracker/tracker.go:43–60  ·  view source on GitHub ↗

AddShards initializes or updates the shard information in the tracker. This should be called when job metadata arrives from the sharder. Returns the current completedThroughSeconds value.

(shards []Shard)

Source from the content-addressed store, hash-verified

41// This should be called when job metadata arrives from the sharder.
42// Returns the current completedThroughSeconds value.
43func (c *CompletionTracker) AddShards(shards []Shard) uint32 {
44 if len(shards) == 0 {
45 return c.completedThroughSeconds
46 }
47
48 c.shards = shards
49
50 // grow foundResponses to match while keeping the existing values
51 if len(c.shards) > len(c.foundResponses) {
52 temp := make([]int, len(c.shards))
53 copy(temp, c.foundResponses)
54 c.foundResponses = temp
55 }
56
57 c.incrementCurShardIfComplete()
58
59 return c.completedThroughSeconds
60}
61
62// AddShardIdx records that a response has been received for the given shard index.
63// This should be called each time a job completes for a particular shard.

Callers 3

TestCompletionTrackerFunction · 0.95
NewSearchFunction · 0.95
NewQueryRangeFunction · 0.95

Calls 1

Tested by 1

TestCompletionTrackerFunction · 0.76