MCPcopy Create free account
hub / github.com/cortexproject/cortex / newCachedScanner

Function newCachedScanner

pkg/util/users/cache.go:26–39  ·  view source on GitHub ↗
(scanner Scanner, cfg UsersScannerConfig, reg prometheus.Registerer)

Source from the content-addressed store, hash-verified

24}
25
26func newCachedScanner(scanner Scanner, cfg UsersScannerConfig, reg prometheus.Registerer) *cachedScanner {
27 return &cachedScanner{
28 scanner: scanner,
29 ttl: cfg.CacheTTL,
30 requests: promauto.With(reg).NewCounter(prometheus.CounterOpts{
31 Name: "cortex_cached_users_scanner_requests_total",
32 Help: "Total number of scans made to the cache scanner",
33 }),
34 hits: promauto.With(reg).NewCounter(prometheus.CounterOpts{
35 Name: "cortex_cached_users_scanner_hits_total",
36 Help: "Total number of hits of scanner cache",
37 }),
38 }
39}
40
41func (s *cachedScanner) ScanUsers(ctx context.Context) ([]string, []string, []string, error) {
42 s.requests.Inc()

Callers 3

NewScannerFunction · 0.85

Calls

no outgoing calls

Tested by 2