Skip to content

Commit

Permalink
Remove groupcache (grafana#7126)
Browse files Browse the repository at this point in the history
As discussed during the caching retro, this PR removes the experimental
distributed cache based on Mailgun's fork of groupcache.

Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
Co-authored-by: Kaviraj <kavirajkanagaraj@gmail.com>
  • Loading branch information
MasslessParticle and kavirajk authored Oct 24, 2022
1 parent ae2a6f3 commit b4ed595
Show file tree
Hide file tree
Showing 40 changed files with 14 additions and 3,952 deletions.
1 change: 0 additions & 1 deletion cmd/loki/loki-local-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ query_range:
cache:
embedded_cache:
enabled: true
distributed: false
max_size_mb: 100

schema_config:
Expand Down
11 changes: 0 additions & 11 deletions docs/sources/configuration/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2896,17 +2896,6 @@ This way, one doesn't have to replicate configuration in multiple places.
# CLI flag: -common.compactor-address
[compactor_address: <string> | default = ""]

# Groupcache is an in-process, distributed cache that behaves similarly to memcached but is built-in to Loki
groupcache:
# Enable groupcache
# CLI flag: -common.groupcache.enabled
[enabled: <boolean>: default = false]
# Set the maximum available memory to use for each groupcache group
# NOTE: there are 3 caches (result, chunk, and index query), so the maximum used memory will be *triple* the value specified here.
# CLI flag: -common.groupcache.capacity-per-cache-mb
[capacity_per_cache_mb: <int>: default = 100]
```
## analytics

The `analytics` block configures the reporting of Loki analytics to grafana.com.
Expand Down
8 changes: 3 additions & 5 deletions docs/sources/upgrading/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,9 @@ Previously, we had two configurations to define a query timeout: `engine.timeout
As they were conflicting and `engine.timeout` isn't as expressive as `querier.query-tiomeout`,
we're deprecating it in favor of relying on `engine.query-timeout` only.

#### Fifocache is deprecated
#### `fifocache` has been renamed

We introduced a new cache called `embedded-cache` which is an in-process cache system that make it possible to run Loki without the need for an external cache (like Memcached, Redis, etc). It can be run in two modes `distributed: false` (default, and same as old `fifocache`) and `distributed: true` which runs cache in distributed fashion sharding keys across peers if Loki is run in microservices or SSD mode.

Currently `embedded-cache` with `distributed: true` can be enabled only for results cache.
The in-memory `fifocache` has been renamed to `embedded-cache`. This allows us to replace the implementation (currently a simple FIFO datastructure) with something else in the future without causing confusion

#### Evenly spread Memcached pods for chunks across kubernetes nodes

Expand Down Expand Up @@ -98,7 +96,7 @@ The global `deletion_mode` option in the compactor configuration moved to runtim
- The `deletion_mode` global override needs to be set to the desired mode: `disabled`, `filter-only`, or `filter-and-delete`. By default, `filter-and-delete` is enabled.
- Any `allow_delete` per-tenant overrides need to be removed or changed to `deletion_mode` overrides with the desired mode.

#### Metric name for `loki_log_messages_total` changed
#### Metric name for `loki_log_messages_total` changed

The name of this metric was changed to `loki_internal_log_messages_total` to reduce ambiguity. The previous name is still present but is deprecated.

Expand Down
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,7 @@ require (
)

require (
github.com/grafana/groupcache_exporter v0.0.0-20220629095919-59a8c6428a43
github.com/heroku/x v0.0.50
github.com/mailgun/groupcache/v2 v2.3.2
github.com/prometheus/alertmanager v0.24.0
github.com/prometheus/common/sigv4 v0.1.0
github.com/thanos-io/objstore v0.0.0-20220715165016-ce338803bc1e
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -713,8 +713,6 @@ github.com/grafana/go-gelf/v2 v2.0.1 h1:BOChP0h/jLeD+7F9mL7tq10xVkDG15he3T1zHuQa
github.com/grafana/go-gelf/v2 v2.0.1/go.mod h1:lexHie0xzYGwCgiRGcvZ723bSNyNI8ZRD4s0CLobh90=
github.com/grafana/gocql v0.0.0-20200605141915-ba5dc39ece85 h1:xLuzPoOzdfNb/RF/IENCw+oLVdZB4G21VPhkHBgwSHY=
github.com/grafana/gocql v0.0.0-20200605141915-ba5dc39ece85/go.mod h1:crI9WX6p0IhrqB+DqIUHulRW853PaNFf7o4UprV//3I=
github.com/grafana/groupcache_exporter v0.0.0-20220629095919-59a8c6428a43 h1:yOw0zAMMp/GXp6eQ2hc5c9w6RcZ44u+QeyNeeAVoV7w=
github.com/grafana/groupcache_exporter v0.0.0-20220629095919-59a8c6428a43/go.mod h1:hgtvYpo9DY0PnOJHQTlV12Uecz0jbDK/o0L9Vz4WvLs=
github.com/grafana/memberlist v0.3.1-0.20220714140823-09ffed8adbbe h1:yIXAAbLswn7VNWBIvM71O2QsgfgW9fRXZNR0DXe6pDU=
github.com/grafana/memberlist v0.3.1-0.20220714140823-09ffed8adbbe/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE=
github.com/grafana/regexp v0.0.0-20221005093135-b4c2bcb0a4b6 h1:A3dhViTeFDSQcGOXuUi6ukCQSMyDtDISBp2z6OOo2YM=
Expand Down Expand Up @@ -945,8 +943,6 @@ github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0U
github.com/linode/linodego v1.9.1 h1:29UpEPpYcGFnbwiJW8mbk/bjBZpgd/pv68io2IKTo34=
github.com/lstoll/grpce v1.7.0/go.mod h1:XiCWl3R+avNCT7KsTjv3qCblgsSqd0SC4ymySrH226g=
github.com/lyft/protoc-gen-validate v0.0.0-20180911180927-64fcb82c878e/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
github.com/mailgun/groupcache/v2 v2.3.2 h1:5dU4h13edj8lqMvdjmpmudv2l6iym5J7jqxf7KeE6Zg=
github.com/mailgun/groupcache/v2 v2.3.2/go.mod h1:tH8aMaTRIjFMJsmJ9p7Y5HGBj9hV/J9rKQ+/3dIXzNU=
github.com/mailru/easyjson v0.0.0-20180717111219-efc7eb8984d6/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
Expand Down
6 changes: 0 additions & 6 deletions pkg/loki/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"github.com/grafana/dskit/flagext"
"github.com/grafana/dskit/netutil"

"github.com/grafana/loki/pkg/storage/chunk/cache"
"github.com/grafana/loki/pkg/storage/chunk/client/aws"
"github.com/grafana/loki/pkg/storage/chunk/client/azure"
"github.com/grafana/loki/pkg/storage/chunk/client/baidubce"
Expand Down Expand Up @@ -44,9 +43,6 @@ type Config struct {

// CompactorAddress is the http address of the compactor in the form http://host:port
CompactorAddress string `yaml:"compactor_address"`

// Global embedded-cache config. Independent of what type of cache, we need some singleton configs like Ring configuration when running in distributed fashion.
EmbeddedCacheConfig cache.EmbeddedCacheSingletonConfig `yaml:"embedded_cache"`
}

func (c *Config) RegisterFlags(f *flag.FlagSet) {
Expand All @@ -61,8 +57,6 @@ func (c *Config) RegisterFlags(f *flag.FlagSet) {
throwaway.Var((*flagext.StringSlice)(&c.InstanceInterfaceNames), "common.instance-interface-names", "List of network interfaces to read address from.")

f.StringVar(&c.CompactorAddress, "common.compactor-address", "", "the http address of the compactor in the form http://host:port")

c.EmbeddedCacheConfig.RegisterFlagsWithPrefix("common.embedded-cache", "", f)
}

type Storage struct {
Expand Down
30 changes: 0 additions & 30 deletions pkg/loki/config_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,6 @@ func applyInstanceConfigs(r, defaults *ConfigWrapper) {
}
r.Frontend.FrontendV2.Addr = r.Common.InstanceAddr
r.IndexGateway.Ring.InstanceAddr = r.Common.InstanceAddr
if r.QueryRange.CacheConfig.EmbeddedCache.IsEnabledWithDistributed() {
r.Common.EmbeddedCacheConfig.Ring.InstanceAddr = r.Common.InstanceAddr
}
}

if !reflect.DeepEqual(r.Common.InstanceInterfaceNames, defaults.Common.InstanceInterfaceNames) {
Expand All @@ -175,9 +172,6 @@ func applyInstanceConfigs(r, defaults *ConfigWrapper) {
}
r.Frontend.FrontendV2.InfNames = r.Common.InstanceInterfaceNames
r.IndexGateway.Ring.InstanceInterfaceNames = r.Common.InstanceInterfaceNames
if r.QueryRange.CacheConfig.EmbeddedCache.IsEnabledWithDistributed() {
r.Common.EmbeddedCacheConfig.Ring.InstanceInterfaceNames = r.Common.InstanceInterfaceNames
}
}
}

Expand Down Expand Up @@ -305,20 +299,6 @@ func applyConfigToRings(r, defaults *ConfigWrapper, rc util.RingConfig, mergeWit
r.IndexGateway.Ring.ZoneAwarenessEnabled = rc.ZoneAwarenessEnabled
r.IndexGateway.Ring.KVStore = rc.KVStore
}

// EmbeddedCache distributed ring.
if r.QueryRange.CacheConfig.EmbeddedCache.IsEnabledWithDistributed() &&
(mergeWithExisting || reflect.DeepEqual(r.Common.EmbeddedCacheConfig.Ring, defaults.Common.EmbeddedCacheConfig.Ring)) {
r.Common.EmbeddedCacheConfig.Ring.HeartbeatTimeout = rc.HeartbeatTimeout
r.Common.EmbeddedCacheConfig.Ring.HeartbeatPeriod = rc.HeartbeatPeriod
r.Common.EmbeddedCacheConfig.Ring.InstancePort = rc.InstancePort
r.Common.EmbeddedCacheConfig.Ring.InstanceAddr = rc.InstanceAddr
r.Common.EmbeddedCacheConfig.Ring.InstanceID = rc.InstanceID
r.Common.EmbeddedCacheConfig.Ring.InstanceInterfaceNames = rc.InstanceInterfaceNames
r.Common.EmbeddedCacheConfig.Ring.InstanceZone = rc.InstanceZone
r.Common.EmbeddedCacheConfig.Ring.ZoneAwarenessEnabled = rc.ZoneAwarenessEnabled
r.Common.EmbeddedCacheConfig.Ring.KVStore = rc.KVStore
}
}

func applyTokensFilePath(cfg *ConfigWrapper) error {
Expand Down Expand Up @@ -349,11 +329,6 @@ func applyTokensFilePath(cfg *ConfigWrapper) error {
}
cfg.IndexGateway.Ring.TokensFilePath = f

f, err = tokensFile(cfg, "groupcache.tokens")
if err != nil {
return err
}
cfg.Common.EmbeddedCacheConfig.Ring.TokensFilePath = f
return nil
}

Expand Down Expand Up @@ -431,10 +406,6 @@ func appendLoopbackInterface(cfg, defaults *ConfigWrapper) {
if reflect.DeepEqual(cfg.IndexGateway.Ring.InstanceInterfaceNames, defaults.IndexGateway.Ring.InstanceInterfaceNames) {
cfg.IndexGateway.Ring.InstanceInterfaceNames = append(cfg.IndexGateway.Ring.InstanceInterfaceNames, loopbackIface)
}

if reflect.DeepEqual(cfg.Common.EmbeddedCacheConfig.Ring.InstanceInterfaceNames, defaults.Common.EmbeddedCacheConfig.Ring.InstanceInterfaceNames) {
cfg.Common.EmbeddedCacheConfig.Ring.InstanceInterfaceNames = append(cfg.Common.EmbeddedCacheConfig.Ring.InstanceInterfaceNames, loopbackIface)
}
}

// applyMemberlistConfig will change the default ingester, distributor, ruler, and query scheduler ring configurations to use memberlist.
Expand All @@ -448,7 +419,6 @@ func applyMemberlistConfig(r *ConfigWrapper) {
r.QueryScheduler.SchedulerRing.KVStore.Store = memberlistStr
r.CompactorConfig.CompactorRing.KVStore.Store = memberlistStr
r.IndexGateway.Ring.KVStore.Store = memberlistStr
r.Common.EmbeddedCacheConfig.Ring.KVStore.Store = memberlistStr
}

var ErrTooManyStorageConfigs = errors.New("too many storage configs provided in the common config, please only define one storage backend")
Expand Down
19 changes: 1 addition & 18 deletions pkg/loki/config_wrapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -824,20 +824,17 @@ ingester:
// ensure they are all false by default
config, _, _ := configWrapperFromYAML(t, minimalConfig, nil)
assert.False(t, config.QueryRange.ResultsCacheConfig.CacheConfig.EmbeddedCache.Enabled)
assert.False(t, config.QueryRange.ResultsCacheConfig.CacheConfig.EmbeddedCache.Distributed)

configFileString := `---
query_range:
results_cache:
cache:
embedded_cache:
enabled: true
distributed: true`
enabled: true`

config, _ = testContext(configFileString, nil)

assert.True(t, config.QueryRange.ResultsCacheConfig.CacheConfig.EmbeddedCache.Enabled)
assert.True(t, config.QueryRange.ResultsCacheConfig.CacheConfig.EmbeddedCache.Distributed)
})
}

Expand Down Expand Up @@ -867,20 +864,6 @@ chunk_store_config:
assert.False(t, config.ChunkStoreConfig.ChunkCacheConfig.EnableFifoCache)
})

t.Run("if distributed cache is set for results cache, FIFO cache should be disabled.", func(t *testing.T) {
configFileString := `---
query_range:
results_cache:
cache:
embedded_cache:
enabled: true
distributed: true`

config, _, _ := configWrapperFromYAML(t, configFileString, nil)
assert.True(t, config.QueryRange.CacheConfig.EmbeddedCache.IsEnabledWithDistributed())
assert.False(t, config.QueryRange.CacheConfig.EnableFifoCache)
})

t.Run("FIFO cache is enabled by default if no other cache is set", func(t *testing.T) {
config, _, _ := configWrapperFromYAML(t, minimalConfig, nil)
assert.True(t, config.ChunkStoreConfig.ChunkCacheConfig.EnableFifoCache)
Expand Down
8 changes: 2 additions & 6 deletions pkg/loki/loki.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import (
"github.com/grafana/loki/pkg/scheduler"
internalserver "github.com/grafana/loki/pkg/server"
"github.com/grafana/loki/pkg/storage"
"github.com/grafana/loki/pkg/storage/chunk/cache"
"github.com/grafana/loki/pkg/storage/config"
"github.com/grafana/loki/pkg/storage/stores/indexshipper/compactor"
"github.com/grafana/loki/pkg/storage/stores/indexshipper/compactor/deletion"
Expand Down Expand Up @@ -270,7 +269,6 @@ type Loki struct {
queryScheduler *scheduler.Scheduler
usageReport *usagestats.Reporter
indexGatewayRingManager *indexgateway.RingManager
embeddedcacheRingManager *cache.GroupcacheRingManager

clientMetrics storage.ClientMetrics
deleteClientMetrics *deletion.DeleteRequestClientMetrics
Expand Down Expand Up @@ -503,7 +501,6 @@ func (t *Loki) setupModuleManager() error {
mm.RegisterModule(RuntimeConfig, t.initRuntimeConfig, modules.UserInvisibleModule)
mm.RegisterModule(MemberlistKV, t.initMemberlistKV, modules.UserInvisibleModule)
mm.RegisterModule(Ring, t.initRing, modules.UserInvisibleModule)
mm.RegisterModule(Embededcache, t.initEmbeddedCache, modules.UserInvisibleModule)
mm.RegisterModule(Overrides, t.initOverrides, modules.UserInvisibleModule)
mm.RegisterModule(OverridesExporter, t.initOverridesExporter)
mm.RegisterModule(TenantConfigs, t.initTenantConfigs, modules.UserInvisibleModule)
Expand Down Expand Up @@ -531,16 +528,15 @@ func (t *Loki) setupModuleManager() error {
// Add dependencies
deps := map[string][]string{
Ring: {RuntimeConfig, Server, MemberlistKV},
Embededcache: {RuntimeConfig, Server, MemberlistKV},
UsageReport: {},
Overrides: {RuntimeConfig},
OverridesExporter: {Overrides, Server},
TenantConfigs: {RuntimeConfig},
Distributor: {Ring, Server, Overrides, TenantConfigs, UsageReport},
Store: {Overrides, Embededcache, IndexGatewayRing},
Store: {Overrides, IndexGatewayRing},
Ingester: {Store, Server, MemberlistKV, TenantConfigs, UsageReport},
Querier: {Store, Ring, Server, IngesterQuerier, TenantConfigs, UsageReport, CacheGenerationLoader},
QueryFrontendTripperware: {Server, Embededcache, Overrides, TenantConfigs},
QueryFrontendTripperware: {Server, Overrides, TenantConfigs},
QueryFrontend: {QueryFrontendTripperware, UsageReport, CacheGenerationLoader},
QueryScheduler: {Server, Overrides, MemberlistKV, UsageReport},
Ruler: {Ring, Server, Store, RulerStorage, IngesterQuerier, Overrides, TenantConfigs, UsageReport},
Expand Down
48 changes: 0 additions & 48 deletions pkg/loki/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import (
"github.com/grafana/loki/pkg/ingester"
"github.com/grafana/loki/pkg/logproto"
"github.com/grafana/loki/pkg/logql"
"github.com/grafana/loki/pkg/logqlmodel/stats"
"github.com/grafana/loki/pkg/lokifrontend/frontend"
"github.com/grafana/loki/pkg/lokifrontend/frontend/transport"
"github.com/grafana/loki/pkg/lokifrontend/frontend/v1/frontendv1pb"
Expand Down Expand Up @@ -74,7 +73,6 @@ const maxChunkAgeForTableManager = 12 * time.Hour
// The various modules that make up Loki.
const (
Ring string = "ring"
Embededcache string = "embedded-cache"
RuntimeConfig string = "runtime-config"
Overrides string = "overrides"
OverridesExporter string = "overrides-exporter"
Expand Down Expand Up @@ -209,49 +207,6 @@ func (t *Loki) initRing() (_ services.Service, err error) {
return t.ring, nil
}

func (t *Loki) initEmbeddedCache() (_ services.Service, err error) {
if !t.Cfg.QueryRange.CacheConfig.EmbeddedCache.IsEnabledWithDistributed() {
return nil, nil
}

groupCacheConfig := cache.GroupCacheConfig{
Enabled: true,
Ring: t.Cfg.Common.EmbeddedCacheConfig.Ring,
MaxSizeMB: t.Cfg.Common.EmbeddedCacheConfig.MaxSizeMB,
ListenPort: t.Cfg.Common.EmbeddedCacheConfig.ListenPort,
HeartbeatInterval: t.Cfg.Common.EmbeddedCacheConfig.HeartbeatInterval,
HeartbeatTimeout: t.Cfg.Common.EmbeddedCacheConfig.HeartbeatTimeout,
WriteByteTimeout: t.Cfg.Common.EmbeddedCacheConfig.WriteByteTimeout,
}

groupCacheConfig.Ring.ListenPort = groupCacheConfig.ListenPort

rm, err := cache.NewGroupcacheRingManager(groupCacheConfig, util_log.Logger, prometheus.DefaultRegisterer)
if err != nil {
return nil, gerrors.Wrap(err, "new embedded-cache ring manager")
}

t.embeddedcacheRingManager = rm
t.Server.HTTP.Path("/embedded-cache/ring").Methods("GET", "POST").Handler(t.embeddedcacheRingManager)

gc, err := cache.NewGroupCache(rm, groupCacheConfig, util_log.Logger, prometheus.DefaultRegisterer)
if err != nil {
return nil, err
}

groupConfig := cache.GroupConfig{
MaxSizeMB: t.Cfg.QueryRange.CacheConfig.EmbeddedCache.MaxSizeMB,
}

t.Cfg.QueryRange.ResultsCacheConfig.CacheConfig.Cache = gc.NewGroup(
t.Cfg.QueryRange.ResultsCacheConfig.CacheConfig.Prefix+"groupcache",
&groupConfig,
stats.ResultCache,
)

return t.embeddedcacheRingManager, nil
}

func (t *Loki) initRuntimeConfig() (services.Service, error) {
if len(t.Cfg.RuntimeConfig.LoadPath) == 0 {
if len(t.Cfg.LimitsConfig.PerTenantOverrideConfig) != 0 {
Expand Down Expand Up @@ -998,9 +953,6 @@ func (t *Loki) initMemberlistKV() (services.Service, error) {
t.Cfg.Ingester.LifecyclerConfig.RingConfig.KVStore.MemberlistKV = t.MemberlistKV.GetMemberlistKV
t.Cfg.QueryScheduler.SchedulerRing.KVStore.MemberlistKV = t.MemberlistKV.GetMemberlistKV
t.Cfg.Ruler.Ring.KVStore.MemberlistKV = t.MemberlistKV.GetMemberlistKV
if t.Cfg.QueryRange.CacheConfig.EmbeddedCache.IsEnabledWithDistributed() {
t.Cfg.Common.EmbeddedCacheConfig.Ring.KVStore.MemberlistKV = t.MemberlistKV.GetMemberlistKV
}

t.Server.HTTP.Handle("/memberlist", t.MemberlistKV)

Expand Down
12 changes: 3 additions & 9 deletions pkg/storage/chunk/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func New(cfg Config, reg prometheus.Registerer, logger log.Logger, cacheType sta

// Have additional check for embeddedcache with distributed mode, because those cache will already be initialized in modules
// but still need stats collector wrapper for it.
if cfg.Cache != nil && !cfg.EmbeddedCache.IsEnabledWithDistributed() {
if cfg.Cache != nil && !cfg.EmbeddedCache.IsEnabled() {
return cfg.Cache, nil
}

Expand All @@ -107,16 +107,15 @@ func New(cfg Config, reg prometheus.Registerer, logger log.Logger, cacheType sta
// Currently fifocache can be enabled in two ways.
// 1. cfg.EnableFifocache (old deprecated way)
// 2. cfg.EmbeddedCache.Enabled=true and cfg.EmbeddedCache.Distributed=false (new way)

if cfg.EnableFifoCache || (IsEmbeddedCacheSet(cfg) && !cfg.EmbeddedCache.Distributed) {
if cfg.EnableFifoCache || cfg.EmbeddedCache.IsEnabled() {
var fifocfg FifoCacheConfig

if cfg.EnableFifoCache {
level.Warn(logger).Log("msg", "fifocache config is deprecated. use embedded-cache instead")
fifocfg = cfg.Fifocache
}

if cfg.EmbeddedCache.IsEnabledWithoutDistributed() {
if cfg.EmbeddedCache.IsEnabled() {
fifocfg = FifoCacheConfig{
MaxSizeBytes: fmt.Sprint(cfg.EmbeddedCache.MaxSizeMB * 1e6),
TTL: cfg.EmbeddedCache.TTL,
Expand Down Expand Up @@ -162,11 +161,6 @@ func New(cfg Config, reg prometheus.Registerer, logger log.Logger, cacheType sta
caches = append(caches, CollectStats(NewBackground(cacheName, cfg.Background, Instrument(cacheName, cache, reg), reg)))
}

if IsEmbeddedCacheSet(cfg) && cfg.EmbeddedCache.Distributed {
cacheName := cfg.Prefix + "embedded-cache"
caches = append(caches, CollectStats(Instrument(cacheName, cfg.Cache, reg)))
}

cache := NewTiered(caches)
if len(caches) > 1 {
cache = Instrument(cfg.Prefix+"tiered", cache, reg)
Expand Down
Loading

0 comments on commit b4ed595

Please sign in to comment.