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 commit 40b619b21a.

* Revert "Small fix"

This reverts commit 2df8319d1d.

* Revert "Change alertValidator return type"

This reverts commit ad933863e3.

* Revert "Fix test"

This reverts commit f728ece2db.

* Revert "Apply suggestions from code review"

This reverts commit f35c5f52af.

* Revert "Apply suggestions from code review"

This reverts commit 7f95800c5f.

* Revert "Rename function parameter"

This reverts commit 95d3e75b00.

* Revert "API: Log alert warnings when saving dashboard"

This reverts commit 1ac5c3f281.

* 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:
Kyle Brandt
2020-10-27 15:57:01 -04:00
committed by GitHub
co-authored by Arve Knudsen Sofia Papagiannaki
parent 12a69876c7
commit 44f691ff91
8 changed files with 26 additions and 19 deletions
+1 -1
View File
@@ -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)