ソースを参照

Removed ExecError state

utkarshcmu 9 年 前
コミット
f8d1eb11a9

+ 1 - 4
pkg/services/alerting/notifiers/pagerduty.go

@@ -22,7 +22,6 @@ func NewPagerdutyNotifier(model *m.AlertNotification) (alerting.Notifier, error)
 	return &PagerdutyNotifier{
 	return &PagerdutyNotifier{
 		NotifierBase:     NewNotifierBase(model.Id, model.IsDefault, model.Name, model.Type, model.Settings),
 		NotifierBase:     NewNotifierBase(model.Id, model.IsDefault, model.Name, model.Type, model.Settings),
 		Key:              key,
 		Key:              key,
-		AlertOnExecError: model.Settings.Get("alertOnExecError").MustBool(),
 		log:              log.New("alerting.notifier.pagerduty"),
 		log:              log.New("alerting.notifier.pagerduty"),
 	}, nil
 	}, nil
 }
 }
@@ -30,7 +29,6 @@ func NewPagerdutyNotifier(model *m.AlertNotification) (alerting.Notifier, error)
 type PagerdutyNotifier struct {
 type PagerdutyNotifier struct {
 	NotifierBase
 	NotifierBase
 	Key              string
 	Key              string
-	AlertOnExecError bool
 	log              log.Logger
 	log              log.Logger
 }
 }
 
 
@@ -38,8 +36,7 @@ func (this *PagerdutyNotifier) Notify(evalContext *alerting.EvalContext) error {
 	this.log.Info("Notifying Pagerduty")
 	this.log.Info("Notifying Pagerduty")
 	metrics.M_Alerting_Notification_Sent_PagerDuty.Inc(1)
 	metrics.M_Alerting_Notification_Sent_PagerDuty.Inc(1)
 
 
-	if (evalContext.Rule.State == m.AlertStateAlerting) ||
-		((this.AlertOnExecError) && (evalContext.Rule.State == m.AlertStateExecError)) {
+	if evalContext.Rule.State == m.AlertStateAlerting {
 
 
 		// Pagerduty Events API URL
 		// Pagerduty Events API URL
 		pgEventsUrl := "https://events.pagerduty.com/generic/2010-04-15/create_event.json"
 		pgEventsUrl := "https://events.pagerduty.com/generic/2010-04-15/create_event.json"

+ 2 - 4
pkg/services/alerting/notifiers/pagerduty_test.go

@@ -26,11 +26,10 @@ func TestPagerdutyNotifier(t *testing.T) {
 				So(err, ShouldNotBeNil)
 				So(err, ShouldNotBeNil)
 			})
 			})
 
 
-			Convey("settings with alertOnExecError should trigger incident", func() {
+			Convey("settings should trigger incident", func() {
 				json := `
 				json := `
 				{
 				{
-          "integrationKey": "abcdefgh0123456789",
-          "alertOnExecError": true
+          "integrationKey": "abcdefgh0123456789"
 				}`
 				}`
 
 
 				settingsJSON, _ := simplejson.NewJson([]byte(json))
 				settingsJSON, _ := simplejson.NewJson([]byte(json))
@@ -47,7 +46,6 @@ func TestPagerdutyNotifier(t *testing.T) {
 				So(pagerdutyNotifier.Name, ShouldEqual, "pagerduty_testing")
 				So(pagerdutyNotifier.Name, ShouldEqual, "pagerduty_testing")
 				So(pagerdutyNotifier.Type, ShouldEqual, "pagerduty")
 				So(pagerdutyNotifier.Type, ShouldEqual, "pagerduty")
 				So(pagerdutyNotifier.Key, ShouldEqual, "abcdefgh0123456789")
 				So(pagerdutyNotifier.Key, ShouldEqual, "abcdefgh0123456789")
-				So(pagerdutyNotifier.AlertOnExecError, ShouldEqual, true)
 			})
 			})
 
 
 		})
 		})

+ 0 - 9
public/app/features/alerting/partials/notification_edit.html

@@ -103,15 +103,6 @@
         <span class="gf-form-label width-12">Integration Key</span>
         <span class="gf-form-label width-12">Integration Key</span>
         <input type="text" required class="gf-form-input max-width-30" ng-model="ctrl.model.settings.integrationKey" placeholder="Pagerduty integeration Key"></input>
         <input type="text" required class="gf-form-input max-width-30" ng-model="ctrl.model.settings.integrationKey" placeholder="Pagerduty integeration Key"></input>
       </div>
       </div>
-      <div class="gf-form">
-        <gf-form-switch
-           class="gf-form"
-           label="Alert on Exec Error"
-           label-class="width-12"
-           checked="ctrl.model.settings.alertOnExecError"
-           tooltip="Trigger incident on Exec Error">
-        </gf-form-switch>
-      </div>
     </div>
     </div>
 
 
     <div class="gf-form-group">
     <div class="gf-form-group">