Alerting: Log alert warnings for obsolete notifiers when extracting alerts and remove spammy error (#28162) (#28582)
* Lower level of notification translation messages * API: Log alert warnings when saving dashboard * Remove spammy error * Rename function parameter * Apply suggestions from code review Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com> * Apply suggestions from code review * Fix test * Change alertValidator return type * Small fix * Rename symbol * Revert "Rename symbol" This reverts commit40b619b21a. * Revert "Small fix" This reverts commit2df8319d1d. * Revert "Change alertValidator return type" This reverts commitad933863e3. * Revert "Fix test" This reverts commitf728ece2db. * Revert "Apply suggestions from code review" This reverts commitf35c5f52af. * Revert "Apply suggestions from code review" This reverts commit7f95800c5f. * Revert "Rename function parameter" This reverts commit95d3e75b00. * Revert "API: Log alert warnings when saving dashboard" This reverts commit1ac5c3f281. * Conditionally log translation failures * Fix issue causing test to fail * Fix test * Log instead of propagating translations failures due to database errors Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com> Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com> Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
co-authored by
Arve Knudsen
Sofia Papagiannaki
parent
12a69876c7
commit
44f691ff91
@@ -185,7 +185,7 @@ func getAlertNotificationUidInternal(query *models.GetAlertNotificationUidQuery,
|
||||
}
|
||||
|
||||
if len(results) == 0 {
|
||||
return fmt.Errorf("Alert notification [ Id: %v, OrgId: %v ] not found", query.Id, query.OrgId)
|
||||
return models.ErrAlertNotificationFailedTranslateUniqueID
|
||||
}
|
||||
|
||||
query.Result = results[0]
|
||||
|
||||
@@ -4,6 +4,7 @@ package sqlstore
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"regexp"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -384,7 +385,7 @@ func TestAlertNotificationSQLAccess(t *testing.T) {
|
||||
err := ss.GetAlertNotificationUidWithId(query)
|
||||
So(query.Result, ShouldEqual, "")
|
||||
So(err, ShouldNotBeNil)
|
||||
So(err.Error(), ShouldEqual, "Alert notification [ Id: -1, OrgId: 100 ] not found")
|
||||
So(errors.Is(err, models.ErrAlertNotificationFailedTranslateUniqueID), ShouldBeTrue)
|
||||
|
||||
cacheKey := newAlertNotificationUidCacheKey(query.OrgId, query.Id)
|
||||
result, found := ss.CacheService.Get(cacheKey)
|
||||
|
||||
Reference in New Issue
Block a user