Skip to content

Commit

Permalink
Merge pull request #2094 from sawsa307/delete-syncer-from-metrics-col…
Browse files Browse the repository at this point in the history
…lector

Delete syncers from metrics collector during GC
  • Loading branch information
k8s-ci-robot authored May 3, 2023
2 parents 8256c7e + b22558e commit 8321bc1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/neg/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ func (manager *syncerManager) garbageCollectSyncer() {
for key, syncer := range manager.syncerMap {
if syncer.IsStopped() && !syncer.IsShuttingDown() {
delete(manager.syncerMap, key)
manager.syncerMetrics.DeleteSyncer(key)
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions pkg/neg/metrics/neg_metrics_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,15 @@ func (sm *SyncerMetrics) SetLabelPropagationStats(key negtypes.NegSyncerKey, lab
sm.syncerLabelProagationStats[key] = labelstatLabelPropagationStats
}

func (sm *SyncerMetrics) DeleteSyncer(key negtypes.NegSyncerKey) {
sm.mu.Lock()
defer sm.mu.Unlock()
delete(sm.syncerStatusMap, key)
delete(sm.syncerEndpointStateMap, key)
delete(sm.syncerEPSStateMap, key)
delete(sm.syncerLabelProagationStats, key)
}

// computeLabelMetrics aggregates label propagation metrics.
func (sm *SyncerMetrics) computeLabelMetrics() LabelPropagationMetrics {
sm.mu.Lock()
Expand Down

0 comments on commit 8321bc1

Please sign in to comment.