Skip to content

Commit

Permalink
update service key -> routing -> for pagerduty2
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanielc committed Apr 30, 2018
1 parent 6bf9c9a commit f8e8dd0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion integrations/streamer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9295,7 +9295,7 @@ stream
c := pagerduty2.NewConfig()
c.Enabled = true
c.URL = ts.URL
c.ServiceKey = "service_key"
c.RoutingKey = "service_key"
pd := pagerduty2.NewService(c, diagService.NewPagerDuty2Handler())
pd.HTTPDService = tm.HTTPDService
tm.PagerDuty2Service = pd
Expand Down
8 changes: 4 additions & 4 deletions server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7442,7 +7442,7 @@ func TestServer_UpdateConfig(t *testing.T) {
{
section: "pagerduty2",
setDefaults: func(c *server.Config) {
c.PagerDuty2.ServiceKey = "secret"
c.PagerDuty2.RoutingKey = "secret"
},
expDefaultSection: client.ConfigSection{
Link: client.Link{Relation: client.Self, Href: "/kapacitor/v1/config/pagerduty2"},
Expand Down Expand Up @@ -8779,9 +8779,9 @@ func TestServer_ListServiceTests(t *testing.T) {
Link: client.Link{Relation: client.Self, Href: "/kapacitor/v1/service-tests/pagerduty2"},
Name: "pagerduty2",
Options: client.ServiceTestOptions{
"incident-key": "testIncidentKey",
"description": "test pagerduty2 message",
"level": "CRITICAL",
"alert_id": "testAlertID",
"description": "test pagerduty2 message",
"level": "CRITICAL",
"event_data": map[string]interface{}{
"Fields": map[string]interface{}{},
"Result": map[string]interface{}{
Expand Down
4 changes: 2 additions & 2 deletions services/pagerduty2/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ type Config struct {
Enabled bool `toml:"enabled" override:"enabled"`
// The PagerDuty API URL, should not need to be changed.
URL string `toml:"url" override:"url"`
// The PagerDuty service key.
ServiceKey string `toml:"service-key" override:"service-key,redact"`
// The PagerDuty routing key, this is associated with an Event v2 API integration service.
RoutingKey string `toml:"routing-key" override:"routing-key,redact"`
// Whether every alert should automatically go to PagerDuty
Global bool `toml:"global" override:"global"`
}
Expand Down
6 changes: 3 additions & 3 deletions services/pagerduty2/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func (s *Service) Test(options interface{}) error {
}
c := s.config()
return s.Alert(
c.ServiceKey,
c.RoutingKey,
o.AlertID,
o.Description,
o.Level,
Expand Down Expand Up @@ -253,7 +253,7 @@ func (s *Service) sendResolve(c Config, serviceKey, alertID string) (string, io.
ap := Resolve{}

if serviceKey == "" {
ap.RoutingKey = c.ServiceKey
ap.RoutingKey = c.RoutingKey
} else {
ap.RoutingKey = serviceKey
}
Expand Down Expand Up @@ -299,7 +299,7 @@ func (s *Service) preparePost(serviceKey, alertID, desc string, level alert.Leve
}

if serviceKey == "" {
ap.RoutingKey = c.ServiceKey
ap.RoutingKey = c.RoutingKey
} else {
ap.RoutingKey = serviceKey
}
Expand Down

0 comments on commit f8e8dd0

Please sign in to comment.