Skip to content

Commit 22c86f5

Browse files
authored
Remove unused selector cache from old dynamic targeting implementation (#954)
* Remove unused selector cache from old dynamic targeting implementation * make generate-mocks
1 parent e9408ce commit 22c86f5

File tree

6 files changed

+0
-78
lines changed

6 files changed

+0
-78
lines changed

controllers/disruption_controller.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ type DisruptionReconciler struct {
7070
log *zap.SugaredLogger
7171
SafetyNets []safemode.Safemode
7272
ExpiredDisruptionGCDelay *time.Duration
73-
CacheContextStore map[string]CtxTuple
7473
DisruptionsWatchersManager watchers.DisruptionsWatchersManager
7574
ChaosPodService services.ChaosPodService
7675
CloudService cloudservice.CloudServicesProvidersManager
@@ -79,12 +78,6 @@ type DisruptionReconciler struct {
7978
FinalizerDeletionDelay time.Duration
8079
}
8180

82-
type CtxTuple struct {
83-
Ctx context.Context
84-
CancelFunc context.CancelFunc
85-
DisruptionNamespacedName types.NamespacedName
86-
}
87-
8881
const TargetsCountLogLimit = 50
8982

9083
func (r *DisruptionReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error) {
@@ -1095,10 +1088,6 @@ func (r *DisruptionReconciler) ReportMetrics(ctx context.Context) {
10951088
if err := r.MetricsSink.MetricPodsGauge(float64(chaosPodsCount)); err != nil {
10961089
r.BaseLog.Errorw("error sending pods.gauge metric", "error", err)
10971090
}
1098-
1099-
if err := r.MetricsSink.MetricSelectorCacheGauge(float64(len(r.CacheContextStore))); err != nil {
1100-
r.BaseLog.Errorw("error sending selector.cache.gauge metric", "error", err)
1101-
}
11021091
}
11031092
}
11041093

main.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ func main() {
225225
TracerSink: tracerSink,
226226
TargetSelector: targetSelector,
227227
ExpiredDisruptionGCDelay: gcPtr,
228-
CacheContextStore: make(map[string]controllers.CtxTuple),
229228
ChaosPodService: chaosPodService,
230229
CloudService: cloudProviderManager,
231230
DisruptionsDeletionTimeout: cfg.Controller.DisruptionDeletionTimeout,
@@ -462,13 +461,6 @@ func main() {
462461
// called, the broadcaster isn't actually initiated
463462
defer broadcaster.Shutdown()
464463

465-
// erase/close caches contexts
466-
defer func() {
467-
for _, contextTuple := range disruptionReconciler.CacheContextStore {
468-
contextTuple.CancelFunc()
469-
}
470-
}()
471-
472464
// +kubebuilder:scaffold:builder
473465

474466
logger.Infow("starting chaos-controller")

o11y/metrics/datadog/datadog.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,6 @@ func (d Sink) MetricWatcherCalls(tags []string) error {
219219
return d.metricWithStatus(d.prefix+"watcher.calls_total", tags)
220220
}
221221

222-
// MetricSelectorCacheGauge reports how many caches are still in the cache array to prevent leaks
223-
func (d Sink) MetricSelectorCacheGauge(gauge float64) error {
224-
return d.client.Gauge(d.prefix+"selector.cache.gauge", gauge, []string{}, 1)
225-
}
226-
227222
// MetricTooLate reports when a scheduled disruption misses its aloted time to be scheduled
228223
// specific to cron and rollout controllers
229224
func (d Sink) MetricTooLate(tags []string) error {

o11y/metrics/metrics.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ type Sink interface {
3636
MetricStuckOnRemovalGauge(gauge float64) error
3737
MetricDisruptionsGauge(gauge float64, tags []string) error
3838
MetricDisruptionsCount(kind chaostypes.DisruptionKindName, tags []string) error
39-
MetricSelectorCacheGauge(gauge float64) error
4039
MetricWatcherCalls(tags []string) error
4140
MetricPodsGauge(gauge float64) error
4241
MetricRestart() error

o11y/metrics/noop/noop.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,6 @@ func (n Sink) MetricWatcherCalls(tags []string) error {
203203
return nil
204204
}
205205

206-
// MetricSelectorCacheGauge reports how many caches are still in the cache array to prevent leaks
207-
func (n Sink) MetricSelectorCacheGauge(gauge float64) error {
208-
n.log.Debugf("NOOP: MetricSelectorCacheGauge %f\n", gauge)
209-
210-
return nil
211-
}
212-
213206
// MetricTooLate reports when a scheduled disruption misses its aloted time to be scheduled
214207
// specific to cron and rollout controllers
215208
func (n Sink) MetricTooLate(tags []string) error {

o11y/metrics/sink_mock.go

Lines changed: 0 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)