Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.

Get multiservice integration working#24

Open
lwoodson wants to merge 4 commits intosquare:masterfrom
bazaarvoice:get_multiservice_integration_working
Open

Get multiservice integration working#24
lwoodson wants to merge 4 commits intosquare:masterfrom
bazaarvoice:get_multiservice_integration_working

Conversation

@lwoodson
Copy link

@lwoodson lwoodson commented Sep 14, 2016

Lib currently does not work with the Bazaarvoice account where we use multiple-services. This PR fixes issues with the lib not supporting multiple service keys and gets the PagerDutyIT.java integration test working with our account. Previous output:

--> POST https://events.pagerduty.com/generic/2010-04-15/create_event.json http/1.1
Content-Type: application/json; charset=UTF-8
Content-Length: 111

{"service_key":"REDACTED","event_type":"trigger","description":"Client IT trigger #1","details":{}}
--> END POST (111-byte body)
<-- 400 Bad Request https://events.pagerduty.com/generic/2010-04-15/create_event.json (1540ms)
Server: nginx
Date: Wed, 14 Sep 2016 14:36:58 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
OkHttp-Sent-Millis: 1473863818416
OkHttp-Received-Millis: 1473863818506

{"status":"invalid event","message":"Event object is invalid","errors":["Service key is the wrong length (should be 32 characters)"]}

Current output after these changes

--> POST https://events.pagerduty.com/generic/2010-04-15/create_event.json http/1.1
Content-Type: application/json; charset=UTF-8
Content-Length: 123

{"service_key":"REDACTED","event_type":"trigger","description":"Client IT trigger #1","details":{}}
--> END POST (123-byte body)
<-- 200 OK https://events.pagerduty.com/generic/2010-04-15/create_event.json (2349ms)
Server: nginx
Date: Wed, 14 Sep 2016 15:30:19 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
OkHttp-Sent-Millis: 1473867019310
OkHttp-Received-Millis: 1473867019535

{"status":"success","message":"Event processed","incident_key":"4a29a86466504d82a70c30beaaa4e284"}
<-- END HTTP (98-byte body)
--> POST https://events.pagerduty.com/generic/2010-04-15/create_event.json http/1.1
Content-Type: application/json; charset=UTF-8
Content-Length: 178

{"service_key":"REDACTED","incident_key":"it-trigger-2","event_type":"trigger","description":"Client IT trigger #2","details":{"Type":"Integration test"}}
--> END POST (178-byte body)
<-- 200 OK https://events.pagerduty.com/generic/2010-04-15/create_event.json (230ms)
Server: nginx
Date: Wed, 14 Sep 2016 15:30:19 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
OkHttp-Sent-Millis: 1473867019543
OkHttp-Received-Millis: 1473867019771

{"status":"success","message":"Event processed","incident_key":"it-trigger-2"}
<-- END HTTP (78-byte body)
--> POST https://events.pagerduty.com/generic/2010-04-15/create_event.json http/1.1
Content-Type: application/json; charset=UTF-8
Content-Length: 165

{"service_key":"REDACTED","incident_key":"4a29a86466504d82a70c30beaaa4e284","event_type":"resolve","description":"Resolving #1","details":{}}
--> END POST (165-byte body)
<-- 200 OK https://events.pagerduty.com/generic/2010-04-15/create_event.json (225ms)
Server: nginx
Date: Wed, 14 Sep 2016 15:30:19 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
OkHttp-Sent-Millis: 1473867019774
OkHttp-Received-Millis: 1473867019999

{"status":"success","message":"Event processed","incident_key":"4a29a86466504d82a70c30beaaa4e284"}
<-- END HTTP (98-byte body)
--> POST https://events.pagerduty.com/generic/2010-04-15/create_event.json http/1.1
Content-Type: application/json; charset=UTF-8
Content-Length: 123

{"service_key":"REDACTED","event_type":"trigger","description":"Client ID trigger #3","details":{}}
--> END POST (123-byte body)
<-- 200 OK https://events.pagerduty.com/generic/2010-04-15/create_event.json (230ms)
Server: nginx
Date: Wed, 14 Sep 2016 15:30:20 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
OkHttp-Sent-Millis: 1473867020001
OkHttp-Received-Millis: 1473867020231

{"status":"success","message":"Event processed","incident_key":"958d06b3113b4a5698024f38c6face25"}
<-- END HTTP (98-byte body)
--> POST https://events.pagerduty.com/generic/2010-04-15/create_event.json http/1.1
Content-Type: application/json; charset=UTF-8
Content-Length: 173

{"service_key":"REDACTED","incident_key":"it-trigger-2","event_type":"trigger","description":"Client IT trigger #2 update 2","details":{"Hey":"Hey"}}
--> END POST (173-byte body)
<-- 200 OK https://events.pagerduty.com/generic/2010-04-15/create_event.json (239ms)
Server: nginx
Date: Wed, 14 Sep 2016 15:30:20 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
OkHttp-Sent-Millis: 1473867020233
OkHttp-Received-Millis: 1473867020472

{"status":"success","message":"Event processed","incident_key":"it-trigger-2"}
<-- END HTTP (78-byte body)
--> POST https://events.pagerduty.com/generic/2010-04-15/create_event.json http/1.1
Content-Type: application/json; charset=UTF-8
Content-Length: 152

{"service_key":"REDACTED","incident_key":"958d06b3113b4a5698024f38c6face25","event_type":"resolve","details":{"Hello":"World!"}}
--> END POST (152-byte body)
<-- 200 OK https://events.pagerduty.com/generic/2010-04-15/create_event.json (229ms)
Server: nginx
Date: Wed, 14 Sep 2016 15:30:20 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
OkHttp-Sent-Millis: 1473867020474
OkHttp-Received-Millis: 1473867020703

{"status":"success","message":"Event processed","incident_key":"958d06b3113b4a5698024f38c6face25"}
<-- END HTTP (98-byte body)
--> POST https://events.pagerduty.com/generic/2010-04-15/create_event.json http/1.1
Content-Type: application/json; charset=UTF-8
Content-Length: 116

{"service_key":"REDACTED","incident_key":"it-trigger-2","event_type":"resolve","details":{}}
--> END POST (116-byte body)
<-- 200 OK https://events.pagerduty.com/generic/2010-04-15/create_event.json (227ms)
Server: nginx
Date: Wed, 14 Sep 2016 15:30:20 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
OkHttp-Sent-Millis: 1473867020705
OkHttp-Received-Millis: 1473867020931

{"status":"success","message":"Event processed","incident_key":"it-trigger-2"}
<-- END HTTP (78-byte body)

Lance Woodson added 3 commits September 14, 2016 09:30
Test currently is broken.  This PR gets it set up to provide an
appropriate feedback loop.

- Allow API key to be specified by env variable
- Setup detailed HTTP logging to get details
@lwoodson
Copy link
Author

Fixing style check errors

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant