github.com/muhammadn/cortex@v1.9.1-0.20220510110439-46bb7000d03d/pkg/ingester/client/custom.go (about)

     1  package client
     2  
     3  // ChunksCount returns the number of chunks in response.
     4  func (m *QueryStreamResponse) ChunksCount() int {
     5  	if len(m.Chunkseries) == 0 {
     6  		return 0
     7  	}
     8  
     9  	count := 0
    10  	for _, entry := range m.Chunkseries {
    11  		count += len(entry.Chunks)
    12  	}
    13  	return count
    14  }
    15  
    16  // ChunksSize returns the size of all chunks in the response.
    17  func (m *QueryStreamResponse) ChunksSize() int {
    18  	if len(m.Chunkseries) == 0 {
    19  		return 0
    20  	}
    21  
    22  	size := 0
    23  	for _, entry := range m.Chunkseries {
    24  		for _, chunk := range entry.Chunks {
    25  			size += chunk.Size()
    26  		}
    27  	}
    28  	return size
    29  }