forked from zulip/zulip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
integrations: Update New Relic integration.
Add new features to the integration, updated media files such as logo and bot avatar, updated doc, updated test fixtures and deleted legacy codes. Fixes zulip#29729 Co-authored-by: Giovanni Silva <no-reply@gsilva.pro>
- Loading branch information
Showing
46 changed files
with
850 additions
and
508 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from enum import Enum | ||
from typing import List, Literal | ||
|
||
# Expected variables from payloads & constant variables | ||
|
||
|
||
class ConstantVariable(Enum): | ||
@classmethod | ||
def as_list(cls, target: Literal["value", "name"] = "value") -> List[str]: | ||
return [item.value for item in cls] if target == "value" else [item.name for item in cls] | ||
|
||
|
||
class IncidentStates(ConstantVariable): | ||
CREATED = "Created" | ||
ACTIVATED = "Activated" | ||
CLOSED = "Closed" | ||
|
||
|
||
class IncidentPrioritiesItems(ConstantVariable): | ||
CRITICAL = ":red_circle:" | ||
HIGH = ":orange_circle:" | ||
MEDIUM = ":yellow:" | ||
LOW = ":blue_circle:" | ||
|
||
|
||
class IncidentTimeStamps(ConstantVariable): | ||
CREATED = "createdAt" | ||
ACTIVATED = "activatedAt" | ||
UPDATED = "updatedAt" | ||
CLOSED = "closedAt" | ||
ACKNOWLEDGED = "acknowledgedAt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,70 @@ | ||
New Relic can send messages to a Zulip stream for incidents. | ||
# New Relic ClickUp integration | ||
|
||
Get Zulip notifications for your New Relic incidents! | ||
|
||
{start_tabs} | ||
|
||
1. {!create-stream.md!} | ||
|
||
1. {!create-an-incoming-webhook.md!} | ||
|
||
1. {!generate-integration-url.md!} | ||
1. {!generate-webhook-url-basic.md!} | ||
|
||
1. On [New Relic](https://one.newrelic.com), | ||
select **Alerts & AI**. | ||
1. Go to the [**Destinations**](https://one.newrelic.com/alerts-ai/notify/destinations) menu and select **Webhook** in the **Add a destination** section. ([*Official Guide*](https://docs.newrelic.com/docs/alerts-applied-intelligence/notifications/notification-integrations/#set-webhook-destination)) | ||
|
||
1. Navigate to **Notification channels**. | ||
1. Set **Endpoint URL** to the URL you generated. | ||
|
||
1. Create a new notification channel. Select channel type of **Webhook**, choose a name (e.g. "Zulip"), enter the webhook url created earlier as **Base Url**. | ||
1. Go to the [**Workflows**](https://one.newrelic.com/alerts-ai/workflows) menu and click on **+ Add a Workflow** button. After filtering the trigger condition, select on the **Webhook** option in the **Add Channel** section. ([*Workflow doc*](https://docs.newrelic.com/docs/alerts-applied-intelligence/applied-intelligence/incident-workflows/incident-workflows/)) | ||
|
||
1. It should look like: | ||
![](/static/images/integrations/newrelic/newrelic.png) | ||
1. Once you're in the **Edit notification message** menu, select the destination for Zulip you've just created earlier. | ||
|
||
1. The webhook works with the default payload, click **Create channel**. | ||
1. If you want to include additional information to the notification, refer to this [section](#displaying-custom-fields-in-payload). There's also an optional [base payload template](#recommended-base-payload-template) we recommend you to use. | ||
|
||
1. After creating the channel send a test notification to make sure it works. | ||
1. Select **Save message** and the **Activate Workflow** to finish. | ||
{end_tabs} | ||
|
||
{!congrats.md!} | ||
|
||
![](/static/images/integrations/newrelic/001.png) | ||
|
||
![](/static/images/integrations/newrelic/002.png) | ||
![](/static/images/integrations/newrelic/003.png) | ||
|
||
### Displaying Custom Fields | ||
|
||
The New Relic integration supports the [custom payload feature](https://docs.newrelic.com/docs/alerts-applied-intelligence/notifications/message-templates/) offered by New Relic. | ||
To include your custom fields in your Zulip New Relic notification, follow these rules: | ||
|
||
* Put all your custom key-value pairs in a new dictionary called `zulipCustomFields`. | ||
|
||
* The Key must be in Camel Case format. Keep in mind that it will be reformatted and | ||
displayed in the notification message, so use descriptive words. | ||
|
||
* The supported data-type for the custom payload are: `string`, `list`, `int` and `bool`. | ||
Custom payload containing `dict` are not supported | ||
|
||
*example custom payload inside `zulipCustomFields`:* | ||
![](/static/images/integrations/newrelic/custom_payload_example.png) | ||
|
||
*the Zulip notification from the payload above:* | ||
![](/static/images/integrations/newrelic/custom_payload_notif.png) | ||
|
||
Only custom fields inside the `zulipCustomFields` dictionary will be displayed | ||
|
||
### Recommended Base Payload Template | ||
|
||
Although the out of the box payload template is already sufficient | ||
to get the integration working, the additional fields provided from | ||
this template will enable the integration to notify you of any | ||
**acknowledged** incidents: | ||
|
||
(THIS IMAGE IS TEMPORARYY, placeholder,) | ||
![](/static/images/integrations/newrelic/temporary_payload_example.png) | ||
|
||
[1]: ./zapier | ||
|
||
[2]: https://raw.githubusercontent.com/zulip/python-zulip-api/main/zulip/integrations/clickup/zulip_clickup.py | ||
|
||
|
||
### Related documentation | ||
|
||
{!webhooks-url-specification.md!} |
11 changes: 11 additions & 0 deletions
11
zerver/webhooks/newrelic/fixtures/essential_fields_default_payload.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"issueUrl": "https://radar-api.service.newrelic.com/accounts/1/issues/0ea2df1c-adab-45d2-aae0-042b609d2322?notifier=SLACK", | ||
"title": "PIETER-UBUNTU query result is > 2.0 for 1 minutes on 'High CPU'", | ||
"priority": "CRITICAL", | ||
"totalIncidents": 1, | ||
"state": "CREATED", | ||
"createdAt": 1713592289021, | ||
"updatedAt": 1713592289021, | ||
"alertPolicyNames": ["Golden Signals"], | ||
"alertConditionNames": ["High CPU"] | ||
} |
25 changes: 25 additions & 0 deletions
25
zerver/webhooks/newrelic/fixtures/incident_acknowledged_default_payload.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"id": "13bbcdca-f0b6-470d-b0be-b34583c58869", | ||
"issueUrl": "https://radar-api.service.newrelic.com/accounts/4420147/issues/13bbcdca-f0b6-470d-b0be-b34583c58869?notifier=WEBHOOK", | ||
"title": "PIETER-UBUNTU query result is > 1.0 for 5 minutes on 'Storage on Host Exceeded Threshold'", | ||
"priority": "HIGH", | ||
"impactedEntities": [ | ||
"PIETER-UBUNTU" | ||
], | ||
"totalIncidents": "1", | ||
"state": "ACTIVATED", | ||
"trigger": "USER_ACTION", | ||
"isCorrelated": "false", | ||
"createdAt": 1713769949493, | ||
"updatedAt": 1713770077412, | ||
"sources": [ | ||
"newrelic" | ||
], | ||
"alertPolicyNames": [ | ||
"Golden Signals" | ||
], | ||
"alertConditionNames": [ | ||
"Storage on Host Exceeded Threshold" | ||
], | ||
"workflowName": "issue workflow" | ||
} |
11 changes: 0 additions & 11 deletions
11
zerver/webhooks/newrelic/fixtures/incident_acknowledged_new.json
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
zerver/webhooks/newrelic/fixtures/incident_acknowledged_old.json
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
zerver/webhooks/newrelic/fixtures/incident_acknowledged_provided_base_payload.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"id": "13bbcdca-f0b6-470d-b0be-b34583c58869", | ||
"issueUrl": "https://radar-api.service.newrelic.com/accounts/4420147/issues/13bbcdca-f0b6-470d-b0be-b34583c58869?notifier=WEBHOOK", | ||
"title": "PIETER-UBUNTU query result is > 1.0 for 5 minutes on 'Storage on Host Exceeded Threshold'", | ||
"priority": "HIGH", | ||
"impactedEntities": [ | ||
"PIETER-UBUNTU" | ||
], | ||
"totalIncidents": "1", | ||
"state": "ACTIVATED", | ||
"trigger": "USER_ACTION", | ||
"isCorrelated": "false", | ||
"createdAt": 1713769949493, | ||
"closedAt": "N/A", | ||
"updatedAt": 1713770077412, | ||
"sources": [ | ||
"newrelic" | ||
], | ||
"alertPolicyNames": [ | ||
"Golden Signals" | ||
], | ||
"alertConditionNames": [ | ||
"Storage on Host Exceeded Threshold" | ||
], | ||
"workflowName": "issue workflow", | ||
"acknowledgedAt": 1713770077412, | ||
"acknowedgedBy": "1005906594", | ||
"owner": "Pieter Cardillo Kwok", | ||
"zulipCustomFields": { | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
zerver/webhooks/newrelic/fixtures/incident_activated_new_default_payload.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"id": "c5faa7e6-7b54-402d-af79-f99601e0278c", | ||
"issueUrl": "https://radar-api.service.newrelic.com/accounts/4420147/issues/c5faa7e6-7b54-402d-af79-f99601e0278c?notifier=WEBHOOK", | ||
"title": "zulip_app query result is > 1.0 for 1 minutes on 'Zulip Server Low Storage'", | ||
"priority": "CRITICAL", | ||
"impactedEntities": [ | ||
"zulip_app" | ||
], | ||
"totalIncidents": 1, | ||
"state": "ACTIVATED", | ||
"trigger": "STATE_CHANGE", | ||
"isCorrelated": false, | ||
"createdAt": 1713755131352, | ||
"updatedAt": 1713769708699, | ||
"sources": [ | ||
"newrelic" | ||
], | ||
"alertPolicyNames": [ | ||
"Golden Signals" | ||
], | ||
"alertConditionNames": [ | ||
"Zulip Server Low Storage" | ||
], | ||
"workflowName": "testWorkflow" | ||
} |
32 changes: 32 additions & 0 deletions
32
zerver/webhooks/newrelic/fixtures/incident_activated_new_provided_base_payload.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"id": "13bbcdca-f0b6-470d-b0be-b34583c58869", | ||
"issueUrl": "https://radar-api.service.newrelic.com/accounts/4420147/issues/13bbcdca-f0b6-470d-b0be-b34583c58869?notifier=WEBHOOK", | ||
"title": "PIETER-UBUNTU query result is > 1.0 for 5 minutes on 'Storage on Host Exceeded Threshold'", | ||
"priority": "HIGH", | ||
"impactedEntities": [ | ||
"PIETER-UBUNTU" | ||
], | ||
"totalIncidents": "1", | ||
"state": "ACTIVATED", | ||
"trigger": "STATE_CHANGE", | ||
"isCorrelated": "false", | ||
"createdAt": 1713769949493, | ||
"closedAt": "N/A", | ||
"updatedAt": 1713769949494, | ||
"sources": [ | ||
"newrelic" | ||
], | ||
"alertPolicyNames": [ | ||
"Golden Signals" | ||
], | ||
"alertConditionNames": [ | ||
"Storage on Host Exceeded Threshold" | ||
], | ||
"workflowName": "issue workflow", | ||
"acknowledgedAt": "N/A", | ||
"acknowedgedBy": "N/A", | ||
"owner": "N/A", | ||
"zulipCustomFields": { | ||
"yourCustomPayload": "somedata123" | ||
} | ||
} |
11 changes: 0 additions & 11 deletions
11
zerver/webhooks/newrelic/fixtures/incident_active_new.json
This file was deleted.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
zerver/webhooks/newrelic/fixtures/incident_closed_default_payload.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"id": "95a9344a-2590-48ce-8d83-07e28b6d22c6", | ||
"issueUrl": "https://radar-api.service.newrelic.com/accounts/1/issues/0ea2df1c-adab-45d2-aae0-042b609d2322?notifier=SLACK", | ||
"title": "main_app-UBUNTU query result is > 2.0 for 1 minutes on 'High CPU'", | ||
"priority": "CRITICAL", | ||
"impactedEntities": ["main_app-UBUNTU"], | ||
"totalIncidents": 1, | ||
"state": "CLOSED", | ||
"trigger": "INCIDENT_CLOSED", | ||
"isCorrelated": false, | ||
"createdAt": 1713766590228, | ||
"updatedAt": 1713766657383, | ||
"sources": ["newrelic"], | ||
"alertPolicyNames": ["Golden Signals"], | ||
"alertConditionNames": ["High CPU"], | ||
"workflowName": "DBA Team workflow" | ||
} |
11 changes: 0 additions & 11 deletions
11
zerver/webhooks/newrelic/fixtures/incident_closed_new.json
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
zerver/webhooks/newrelic/fixtures/incident_closed_old.json
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
zerver/webhooks/newrelic/fixtures/incident_closed_provided_base_payload.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"id": "13bbcdca-f0b6-470d-b0be-b34583c58869", | ||
"issueUrl": "https://radar-api.service.newrelic.com/accounts/4420147/issues/13bbcdca-f0b6-470d-b0be-b34583c58869?notifier=WEBHOOK", | ||
"title": "PIETER-UBUNTU query result is > 1.0 for 5 minutes on 'Storage on Host Exceeded Threshold'", | ||
"priority": "HIGH", | ||
"impactedEntities": [ | ||
"PIETER-UBUNTU" | ||
], | ||
"totalIncidents": "1", | ||
"state": "CLOSED", | ||
"trigger": "USER_ACTION", | ||
"isCorrelated": "false", | ||
"createdAt": 1713769949493, | ||
"closedAt": 1713770135419, | ||
"updatedAt": 1713770135419, | ||
"sources": [ | ||
"newrelic" | ||
], | ||
"alertPolicyNames": [ | ||
"Golden Signals" | ||
], | ||
"alertConditionNames": [ | ||
"Storage on Host Exceeded Threshold" | ||
], | ||
"workflowName": "issue workflow", | ||
"acknowledgedAt": 1713770077412, | ||
"acknowedgedBy": "1005906594", | ||
"owner": "Pieter Cardillo Kwok", | ||
"zulipCustomFields": { | ||
"yourCustomPayload": "somedata123" | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
zerver/webhooks/newrelic/fixtures/incident_created_default_payload.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"id": "208c5e92-f250-40be-b7c2-50508c268c15", | ||
"issueUrl": "https://radar-api.service.newrelic.com/accounts/1/issues/0ea2df1c-adab-45d2-aae0-042b609d2322?notifier=SLACK", | ||
"title": "MAIN-APP-UBUNTU query result is > 2.0 for 1 minutes on 'High CPU'", | ||
"priority": "CRITICAL", | ||
"impactedEntities": [ | ||
"MAIN-APP-UBUNTU" | ||
], | ||
"totalIncidents": 1, | ||
"state": "CREATED", | ||
"trigger": "INCIDENT_ADDED", | ||
"isCorrelated": false, | ||
"createdAt": 1713767789495, | ||
"updatedAt": 1713767789495, | ||
"sources": [ | ||
"newrelic" | ||
], | ||
"alertPolicyNames": [ | ||
"Golden Signals" | ||
], | ||
"alertConditionNames": [ | ||
"High CPU" | ||
], | ||
"workflowName": "DBA Team workflow" | ||
} |
Oops, something went wrong.