diff --git a/go.sum b/go.sum index 0af76e267d..c4ca1735f0 100644 --- a/go.sum +++ b/go.sum @@ -1279,13 +1279,8 @@ github.com/grafana/gomemcache v0.0.0-20241016125027-0a5bcc5aef40 h1:1TeKhyS+pvzO github.com/grafana/gomemcache v0.0.0-20241016125027-0a5bcc5aef40/go.mod h1:IGRj8oOoxwJbHBYl1+OhS9UjQR0dv6SQOep7HqmtyFU= 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= -<<<<<<< HEAD github.com/grafana/mimir-prometheus v0.0.0-20241224134504-460b7be5bce8 h1:/TwjdoLAxL7URxKJGJUeI539w6LUqcwIcj0WCUxDY/c= github.com/grafana/mimir-prometheus v0.0.0-20241224134504-460b7be5bce8/go.mod h1:a5LEa2Vy87wOp0Vu6sLmEIR1V59fqH3QosOSiErAr30= -======= -github.com/grafana/mimir-prometheus v0.0.0-20241219104229-b50052711673 h1:z3nSCBMtEMtD/LAIkwrHsT03n7qgeU+0M6rEMZQbxVI= -github.com/grafana/mimir-prometheus v0.0.0-20241219104229-b50052711673/go.mod h1:a5LEa2Vy87wOp0Vu6sLmEIR1V59fqH3QosOSiErAr30= ->>>>>>> origin/r322 github.com/grafana/opentracing-contrib-go-stdlib v0.0.0-20230509071955-f410e79da956 h1:em1oddjXL8c1tL0iFdtVtPloq2hRPen2MJQKoAWpxu0= github.com/grafana/opentracing-contrib-go-stdlib v0.0.0-20230509071955-f410e79da956/go.mod h1:qtI1ogk+2JhVPIXVc6q+NHziSmy2W5GbdQZFUHADCBU= github.com/grafana/prometheus-alertmanager v0.25.1-0.20240930132144-b5e64e81e8d3 h1:6D2gGAwyQBElSrp3E+9lSr7k8gLuP3Aiy20rweLWeBw= diff --git a/pkg/costattribution/manager.go b/pkg/costattribution/manager.go index 6dcf9bc872..ba6f5608f4 100644 --- a/pkg/costattribution/manager.go +++ b/pkg/costattribution/manager.go @@ -109,16 +109,16 @@ func (m *Manager) deleteTracker(userID string) { } func (m *Manager) updateTracker(userID string) *Tracker { - t := m.Tracker(userID) - - if t == nil { + if !m.EnabledForUser(userID) { m.deleteTracker(userID) return nil } + t := m.Tracker(userID) + lbls := m.limits.CostAttributionLabels(userID) - newTrackedLabels := make([]string, 0, len(lbls)) + newTrackedLabels := make([]string, len(lbls)) copy(newTrackedLabels, lbls) // sort the labels to ensure the order is consistent diff --git a/pkg/costattribution/tracker.go b/pkg/costattribution/tracker.go index 74233e3a68..3caceb37a7 100644 --- a/pkg/costattribution/tracker.go +++ b/pkg/costattribution/tracker.go @@ -80,6 +80,7 @@ func newTracker(userID string, trackedLabels []string, limit int, cooldown time. logger: logger, overflowLabels: overflowLabels, totalFailedActiveSeries: atomic.NewFloat64(0), + cooldownUntil: 0, } tracker.discardedSampleAttribution = prometheus.NewDesc("cortex_discarded_attributed_samples_total", @@ -329,7 +330,7 @@ func (t *Tracker) createNewObservation(key []byte, ts int64, activeSeriesIncreme func (t *Tracker) recoverFromOverflow(deadline int64) bool { t.observedMtx.RLock() - if t.cooldownUntil != 0 && t.cooldownUntil < deadline { + if t.cooldownUntil > 0 && t.cooldownUntil < deadline { if len(t.observed) <= t.maxCardinality { t.observedMtx.RUnlock() return true diff --git a/pkg/mimir/modules.go b/pkg/mimir/modules.go index cf4999a01d..d4a6f0bca4 100644 --- a/pkg/mimir/modules.go +++ b/pkg/mimir/modules.go @@ -1203,10 +1203,10 @@ func (t *Mimir) setupModuleManager() error { Overrides: {RuntimeConfig}, OverridesExporter: {Overrides, MemberlistKV, Vault}, Distributor: {DistributorService, API, ActiveGroupsCleanupService, Vault}, - DistributorService: {IngesterRing, IngesterPartitionRing, Overrides, Vault, CostAttributionService}, - CostAttributionService: {API, Overrides}, + DistributorService: {IngesterRing, IngesterPartitionRing, Overrides, Vault, CostAttributionService}, + CostAttributionService: {API, Overrides}, Ingester: {IngesterService, API, ActiveGroupsCleanupService, Vault}, - IngesterService: {IngesterRing, IngesterPartitionRing, Overrides, RuntimeConfig, MemberlistKV, CostAttributionService}, + IngesterService: {IngesterRing, IngesterPartitionRing, Overrides, RuntimeConfig, MemberlistKV, CostAttributionService}, Flusher: {Overrides, API}, Queryable: {Overrides, DistributorService, IngesterRing, IngesterPartitionRing, API, StoreQueryable, MemberlistKV}, Querier: {TenantFederation, Vault}, @@ -1228,7 +1228,6 @@ func (t *Mimir) setupModuleManager() error { Read: {QueryFrontend, Querier}, Backend: {QueryScheduler, Ruler, StoreGateway, Compactor, AlertManager, OverridesExporter}, All: {QueryFrontend, Querier, Ingester, Distributor, StoreGateway, Ruler, Compactor}, ->>>>>>> origin/r322 } for mod, targets := range deps { if err := mm.AddDependency(mod, targets...); err != nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index 1f67df92c2..cedb067c5c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1688,11 +1688,7 @@ sigs.k8s.io/kustomize/kyaml/yaml/walk sigs.k8s.io/yaml sigs.k8s.io/yaml/goyaml.v2 sigs.k8s.io/yaml/goyaml.v3 -<<<<<<< HEAD # github.com/prometheus/prometheus => github.com/grafana/mimir-prometheus v0.0.0-20241224134504-460b7be5bce8 -======= -# github.com/prometheus/prometheus => github.com/grafana/mimir-prometheus v0.0.0-20241219104229-b50052711673 ->>>>>>> origin/r322 # github.com/hashicorp/memberlist => github.com/grafana/memberlist v0.3.1-0.20220714140823-09ffed8adbbe # gopkg.in/yaml.v3 => github.com/colega/go-yaml-yaml v0.0.0-20220720105220-255a8d16d094 # github.com/grafana/regexp => github.com/grafana/regexp v0.0.0-20240531075221-3685f1377d7b