Пример #1
0
func countSeries(tstore *tsdb.Store) int {
	var count int
	for _, shardID := range tstore.ShardIDs() {
		shard := tstore.Shard(shardID)
		cnt, err := shard.SeriesCount()
		if err != nil {
			fmt.Printf("series count failed: %v\n", err)
			continue
		}
		count += cnt
	}
	return count
}
Пример #2
0
func chunkedWriteStoreShard(store *tsdb.Store, shardID int, points []tsdb.Point) {
	nPts := len(points)
	chunkSz := 10000
	start := 0
	end := chunkSz

	for {
		if end > nPts {
			end = nPts
		}
		if end-start == 0 {
			break
		}

		store.WriteToShard(uint64(shardID), points[start:end])
		start = end
		end += chunkSz
	}
}