Skip to content

Commit

Permalink
fix(query/query-frontend): correct congestion control stats aggregati…
Browse files Browse the repository at this point in the history
…on (#12072)

Signed-off-by: Danny Kopping <[email protected]>
  • Loading branch information
Danny Kopping authored Feb 28, 2024
1 parent 609fdb3 commit b5f488c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions pkg/logqlmodel/stats/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ func (c *Context) Ingester() Ingester {
}
}

// Querier returns the store statistics accumulated so far.
func (c *Context) Querier() Querier {
return c.querier
// Store returns the store statistics accumulated so far.
func (c *Context) Store() Store {
return c.store
}

// Caches returns the cache statistics accumulated so far.
Expand Down Expand Up @@ -188,6 +188,7 @@ func (r *Result) ComputeSummary(execTime time.Duration, queueTime time.Duration,
func (s *Store) Merge(m Store) {
s.TotalChunksRef += m.TotalChunksRef
s.TotalChunksDownloaded += m.TotalChunksDownloaded
s.CongestionControlLatency += m.CongestionControlLatency
s.ChunksDownloadTime += m.ChunksDownloadTime
s.ChunkRefsFetchTime += m.ChunkRefsFetchTime
s.Chunk.HeadChunkBytes += m.Chunk.HeadChunkBytes
Expand Down Expand Up @@ -370,7 +371,7 @@ func (c *Context) AddChunkRefsFetchTime(i time.Duration) {
}

func (c *Context) AddCongestionControlLatency(i time.Duration) {
atomic.AddInt64(&c.querier.Store.CongestionControlLatency, int64(i))
atomic.AddInt64(&c.store.CongestionControlLatency, int64(i))
}

func (c *Context) AddChunksDownloaded(i int64) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/chunk/client/congestion/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func TestAIMDReducedThroughput(t *testing.T) {
require.Less(t, success, count)

// should have registered some congestion latency in stats
require.NotZero(t, statsCtx.Querier().Store.CongestionControlLatency)
require.NotZero(t, statsCtx.Store().CongestionControlLatency)
}

func runAndMeasureRate(ctx context.Context, ctrl Controller, duration time.Duration) (float64, float64) {
Expand Down

0 comments on commit b5f488c

Please sign in to comment.