77
88 "github.com/grafana/grafana-foundation-sdk/go/alerting"
99 "github.com/grafana/grafana-foundation-sdk/go/dashboard"
10+
1011 "github.com/smartcontractkit/chainlink-common/observability-lib/api"
1112)
1213
@@ -73,7 +74,7 @@ func getAlertRules(grafanaClient *api.Client, dashboardUID *string, folderUID st
7374 }
7475
7576 // check for alert rules by folder UID and group name
76- if alertGroups != nil && len (alertGroups ) > 0 {
77+ if len (alertGroups ) > 0 {
7778 for _ , alertGroup := range alertGroups {
7879 alertsRulePerGroup , errGetAlertRulesPerGroup := grafanaClient .GetAlertRulesByFolderUIDAndGroupName (folderUID , * alertGroup .Title )
7980 if errGetAlertRulesPerGroup != nil {
@@ -219,7 +220,7 @@ func (o *Observability) DeployToGrafana(options *DeployOptions) error {
219220 }
220221
221222 // Create contact points for the alerts
222- if o . ContactPoints != nil && len (o .ContactPoints ) > 0 {
223+ if len (o .ContactPoints ) > 0 {
223224 for _ , contactPoint := range o .ContactPoints {
224225 errCreateOrUpdateContactPoint := grafanaClient .CreateOrUpdateContactPoint (contactPoint )
225226 if errCreateOrUpdateContactPoint != nil {
@@ -229,7 +230,7 @@ func (o *Observability) DeployToGrafana(options *DeployOptions) error {
229230 }
230231
231232 // Create notification policies for the alerts
232- if o . NotificationPolicies != nil && len (o .NotificationPolicies ) > 0 {
233+ if len (o .NotificationPolicies ) > 0 {
233234 for _ , notificationPolicy := range o .NotificationPolicies {
234235 errAddNestedPolicy := grafanaClient .AddNestedPolicy (notificationPolicy )
235236 if errAddNestedPolicy != nil {
0 commit comments