Skip to content

Commit 6a6f030

Browse files
author
Christian Roessner
committed
Fix: Update caching stats conditions to include zero differences
Previously, the statistics were only updated if the differences were greater than zero. This commit changes the conditions to include differences equal to zero, ensuring that all conditions of misses, hits, and timeouts are accurately represented in the statistics. This will provide a more comprehensive view of the system's caching performance. Signed-off-by: Christian Roessner <[email protected]>
1 parent 401a7b1 commit 6a6f030

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

server/core/statistics.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -150,21 +150,21 @@ func UpdateRedisPoolStats() {
150150

151151
if previousHit, ok := previousHits[poolName]; ok {
152152
hitsDiff := currentHits - previousHit
153-
if hitsDiff > 0 {
153+
if hitsDiff >= 0 {
154154
stats.RedisHits.With(prometheus.Labels{global.ReisPromPoolName: poolName}).Set(hitsDiff)
155155
}
156156
}
157157

158158
if previousMiss, ok := previousMisses[poolName]; ok {
159159
missesDiff := currentMisses - previousMiss
160-
if missesDiff > 0 {
160+
if missesDiff >= 0 {
161161
stats.RedisMisses.With(prometheus.Labels{global.ReisPromPoolName: poolName}).Set(missesDiff)
162162
}
163163
}
164164

165165
if previousTimeout, ok := previousTimeouts[poolName]; ok {
166166
timeoutsDiff := currentTimeouts - previousTimeout
167-
if timeoutsDiff > 0 {
167+
if timeoutsDiff >= 0 {
168168
stats.RedisTimeouts.With(prometheus.Labels{global.ReisPromPoolName: poolName}).Set(timeoutsDiff)
169169
}
170170
}

0 commit comments

Comments
 (0)