Alerting: Replace FileStore() for CleanUp() in the Alertmanager interface (#77126)

Alerting: Remplace FileStore() for CleanUp() in the Alertmanager interface
This commit is contained in:
Santiago
2023-10-25 13:58:28 +02:00
committed by GitHub
parent aa7a6da985
commit 322a9c0b15
3 changed files with 9 additions and 9 deletions

View File

@@ -403,8 +403,9 @@ func (am *alertmanager) OrgID() int64 {
return am.orgID
}
func (am *alertmanager) FileStore() *FileStore {
return am.fileStore
// CleanUp removes the directory containing the alertmanager files from disk.
func (am *alertmanager) CleanUp() {
am.fileStore.CleanUp()
}
// AlertValidationError is the error capturing the validation errors

View File

@@ -54,9 +54,9 @@ type Alertmanager interface {
TestTemplate(ctx context.Context, c apimodels.TestTemplatesConfigBodyParams) (*TestTemplatesResults, error)
// State
CleanUp()
StopAndWait()
Ready() bool
FileStore() *FileStore
OrgID() int64
ConfigHash() [16]byte
}
@@ -314,8 +314,8 @@ func (moa *MultiOrgAlertmanager) SyncAlertmanagersForOrgs(ctx context.Context, o
moa.logger.Info("Stopping Alertmanager", "org", orgID)
am.StopAndWait()
moa.logger.Info("Stopped Alertmanager", "org", orgID)
// Cleanup all the remaining resources from this alertmanager.
am.FileStore().CleanUp()
// Clean up all the remaining resources from this alertmanager.
am.CleanUp()
}
// We look for orphan directories and remove them. Orphan directories can
@@ -350,7 +350,7 @@ func (moa *MultiOrgAlertmanager) cleanupOrphanLocalOrgState(ctx context.Context,
moa.logger.Info("Found orphan organization directory", "orgID", orgID)
workingDirPath := filepath.Join(dataDir, strconv.FormatInt(orgID, 10))
fileStore := NewFileStore(orgID, moa.kvStore, workingDirPath)
// Cleanup all the remaining resources from this alertmanager.
// Clean up all the remaining resources from this alertmanager.
fileStore.CleanUp()
}
}

View File

@@ -294,9 +294,8 @@ func (am *Alertmanager) Ready() bool {
return am.ready
}
func (am *Alertmanager) FileStore() *notifier.FileStore {
return &notifier.FileStore{}
}
// We don't have files on disk, no-op.
func (am *Alertmanager) CleanUp() {}
func (am *Alertmanager) OrgID() int64 {
return am.orgID