Skip to content

Commit 23e5927

Browse files
taharahpracucci
andauthored
fix: set correct number of keys in background cache metrics (#2764)
Signed-off-by: Trevor Wood <[email protected]> Co-authored-by: Marco Pracucci <[email protected]>
1 parent e0cfad7 commit 23e5927

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@
139139
* [BUGFIX] Cassandra: fixed an edge case leading to an invalid CQL query when querying the index on a Cassandra store. #2639
140140
* [BUGFIX] Ingester: increment series per metric when recovering from WAL or transfer. #2674
141141
* [BUGFIX] Fixed `wrong number of arguments for 'mget' command` Redis error when a query has no chunks to lookup from storage. #2700
142+
* [BUGFIX] Fixed the number of reported keys in the background cache queue. #2764
142143
* [BUGFIX] Ingester: Automatically remove old tmp checkpoints, fixing a potential disk space leak after an ingester crashes.
143144
* [BUGFIX] Fix race in processing of headers in sharded queries. #2762
144145

pkg/chunk/cache/background.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,12 @@ func (c *backgroundCache) Store(ctx context.Context, keys []string, bufs [][]byt
9696
}
9797
select {
9898
case c.bgWrites <- bgWrite:
99-
c.queueLength.Add(float64(len(keys)))
99+
c.queueLength.Add(float64(num))
100100
default:
101-
c.droppedWriteBack.Add(float64(len(keys)))
101+
c.droppedWriteBack.Add(float64(num))
102102
sp := opentracing.SpanFromContext(ctx)
103103
if sp != nil {
104-
sp.LogFields(otlog.Int("dropped", len(keys)))
104+
sp.LogFields(otlog.Int("dropped", num))
105105
}
106106
return // queue is full; give up
107107
}

0 commit comments

Comments
 (0)