Skip to content

Commit d3bdb0b

Browse files
moved counter out of if, to ensure it is always enabled
1 parent 04e72a4 commit d3bdb0b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

internal/cortex/frontend/transport/handler.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,6 @@ func NewHandler(cfg HandlerConfig, roundTripper http.RoundTripper, log log.Logge
121121
Help: "Size of all chunks fetched to execute a query in bytes.",
122122
}, []string{"user"})
123123

124-
h.cachedHits = promauto.With(reg).NewCounter(prometheus.CounterOpts{
125-
Name: "cached_failed_queries_count",
126-
Help: "Total number of queries that hit the cache.",
127-
})
128-
129124
h.activeUsers = util.NewActiveUsersCleanupWithDefaultValues(func(user string) {
130125
h.querySeconds.DeleteLabelValues(user)
131126
h.querySeries.DeleteLabelValues(user)
@@ -136,6 +131,11 @@ func NewHandler(cfg HandlerConfig, roundTripper http.RoundTripper, log log.Logge
136131
_ = h.activeUsers.StartAsync(context.Background())
137132
}
138133

134+
h.cachedHits = promauto.With(reg).NewCounter(prometheus.CounterOpts{
135+
Name: "cached_failed_queries_count",
136+
Help: "Total number of queries that hit the cache.",
137+
})
138+
139139
return h
140140
}
141141

0 commit comments

Comments
 (0)