Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
integration: Delete Opbeat integration.
PieterCK949462002225
diff --git a/static/images/integrations/bot_avatars/opbeat.png b/static/images/integrations/bot_avatars/opbeat.pngdeleted file mode 100644index bd004dec913..00000000000Binary files a/static/images/integrations/bot_avatars/opbeat.png and /dev/null differdiff --git a/static/images/integrations/logos/opbeat.svg b/static/images/integrations/logos/opbeat.svgdeleted file mode 100644index ffd36ca2bff..00000000000--- a/static/images/integrations/logos/opbeat.svg+++ /dev/null@@ -1 +0,0 @@-<svg width="600" height="557" xmlns="http://www.w3.org/2000/svg"><path d="M213.796 290.084c-81.931-30.016-124.457-38.868-140.219-41.4 8.995-14.467 19.71-27.932 32.048-40.007l299.542-.156c17.953 17.528 32.54 37.96 43.296 60.21-28.757 22.161-108.227 67.669-234.667 21.353zm165.245-28.555h-53.046c-8.26 0-15.017 6.418-15.017 14.272 0 7.855 6.758 14.283 15.017 14.283h53.046c8.259 0 15.015-6.428 15.015-14.283 0-7.854-6.756-14.272-15.015-14.272zm0 87.23h-53.046c-8.26 0-15.017-6.428-15.017-14.288 0-7.85 6.758-14.268 15.017-14.268h53.046c8.259 0 15.015 6.419 15.015 14.268 0 7.86-6.756 14.287-15.015 14.287zm0 58.433h-53.046c-8.26 0-15.017-6.432-15.017-14.283 0-7.849 6.758-14.268 15.017-14.268h53.046c8.259 0 15.015 6.42 15.015 14.268 0 7.85-6.756 14.283-15.015 14.283zm0 58.67h-53.046c-8.26 0-15.017-6.428-15.017-14.283 0-7.844 6.758-14.272 15.017-14.272h53.046c8.259 0 15.015 6.428 15.015 14.272 0 7.855-6.756 14.283-15.015 14.283zm48.021-293.075-5.873-5.326-331.642.174-5.856 5.326C30.504 221.357 0 290.334 0 362.218c0 72.012 30.58 141.065 83.9 189.46L89.76 557l331.636-.17 5.86-5.331c53.189-48.396 83.687-117.369 83.687-189.28 0-71.998-30.57-141.042-83.88-189.432zM129.59 104.495l-1.057-2.695c-1.238-2.58-2.72-5.34-4.43-8.26a94.811 94.811 0 0 0-2.21-3.687h-.02l-.858-1.342c-9.057-14.16-21.088-28.32-31.392-36.94L70.63 35.645l335.878 24.217c2.526.18 4.245.643 5.236.993l2.73.954-.954 2.741c-.515 1.475-1.34 3.053-2.456 4.688l-2.332 3.44c-6.143 9.085-17.556 31.1-21.82 39.436l-254.348.065a103.282 103.282 0 0 0-2.975-7.683zm400.129 60.815c-20.796-25.474-44.014-43.868-67.189-53.22l-36.387.008.586-1.006c4.717-8.138 12.824-22.25 12.943-22.44 11.464-16.938 14.647-30.974 9.444-41.712-5.61-11.58-21.736-20.247-40.128-21.58L60.035.2A81.984 81.984 0 0 0 54.5 0C32.68 0 25.488 10.842 23.138 17.307 18.827 29.17 24.1 41.769 38.503 53.83c.16.15 16.607 15.388 31.977 31.23 7.248 7.174 13.032 16.296 17.188 27.127l.576 36.09 354.09-.497s27.273 11.735 54.165 44.685c38.006 46.585 72.525 131.565 56.8 231.546h43.32c15.383-111.333-24.3-206.483-66.901-258.702z" fill="#3360A3" fill-rule="evenodd"/></svg>\ No newline at end of filediff --git a/static/images/integrations/opbeat/001.png b/static/images/integrations/opbeat/001.pngdeleted file mode 100644index f7735bddc45..00000000000Binary files a/static/images/integrations/opbeat/001.png and /dev/null differdiff --git a/zerver/lib/integrations.py b/zerver/lib/integrations.pyindex 83ae76613d6..e04956db16d 100644--- a/zerver/lib/integrations.py+++ b/zerver/lib/integrations.py@@ -444,13 +444,6 @@ WEBHOOK_INTEGRATIONS: list[WebhookIntegration] = [WebhookIntegration("mention", ["marketing"], display_name="Mention"),WebhookIntegration("netlify", ["continuous-integration", "deployment"], display_name="Netlify"),WebhookIntegration("newrelic", ["monitoring"], display_name="New Relic"),- WebhookIntegration(- "opbeat",- ["monitoring"],- display_name="Opbeat",- stream_name="opbeat",- function="zerver.webhooks.opbeat.view.api_opbeat_webhook",- ),WebhookIntegration("opencollective", ["communication"], display_name="Open Collective"),WebhookIntegration("opsgenie", ["meta-integration", "monitoring"]),WebhookIntegration("pagerduty", ["monitoring"], display_name="PagerDuty"),@@ -785,7 +778,6 @@ DOC_SCREENSHOT_CONFIG: dict[str, list[BaseScreenshotConfig]] = {ScreenshotConfig("incident_acknowledged_new.json", "002.png"),ScreenshotConfig("incident_closed_new.json", "003.png"),],- "opbeat": [ScreenshotConfig("error_reopen.json")],"opencollective": [ScreenshotConfig("one_time_donation.json")],"opsgenie": [ScreenshotConfig("addrecipient.json", image_name="000.png")],"pagerduty": [ScreenshotConfig("trigger_v2.json")],diff --git a/zerver/webhooks/opbeat/__init__.py b/zerver/webhooks/opbeat/__init__.pydeleted file mode 100644index e69de29bb2d..00000000000diff --git a/zerver/webhooks/opbeat/doc.md b/zerver/webhooks/opbeat/doc.mddeleted file mode 100644index adc83757c19..00000000000--- a/zerver/webhooks/opbeat/doc.md+++ /dev/null@@ -1,16 +0,0 @@-Get Zulip notifications for your Opbeat events!--1. {!create-channel.md!}--1. {!create-an-incoming-webhook.md!}--1. {!generate-integration-url.md!}--1. Go to your Opbeat **Organization Settings**.--1. Under **HTTP Hook (Experimental)**, set **Hook target**- to the URL constructed above, and click **Save settings**.--{!congrats.md!}--diff --git a/zerver/webhooks/opbeat/fixtures/error_fixed.json b/zerver/webhooks/opbeat/fixtures/error_fixed.jsondeleted file mode 100644index 7ea08abb77a..00000000000--- a/zerver/webhooks/opbeat/fixtures/error_fixed.json+++ /dev/null@@ -1,122 +0,0 @@-{- "id": "bf991a45d9184b0ca6fb3d48d3db4c38",- "url": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/activities/bf991a45d9184b0ca6fb3d48d3db4c38",- "html_url": "https://opbeat.com/test_org/test-flask-app/errors/2/#activity-bf991a45d9184b0ca6fb3d48d3db4c38",- "author": {- "id": "5802edc6e84b4843b23edff00c6d300a",- "legacy_id": 14883,- "first_name": "foo",- "last_name": "E",- "email": "[email protected]",- "avatar": {- "40": "https://secure.gravatar.com/avatar/cf936cf5a05314e692830f4d17ec434e?d=https%3A%2F%2Fopbeat.com%2Fstatic%2Fimages%2Fcommon%2Favatars%2Favatar_default_user.png&size=40",- "80": "https://secure.gravatar.com/avatar/cf936cf5a05314e692830f4d17ec434e?d=https%3A%2F%2Fopbeat.com%2Fstatic%2Fimages%2Fcommon%2Favatars%2Favatar_default_user.png&size=80",- "180": "https://secure.gravatar.com/avatar/cf936cf5a05314e692830f4d17ec434e?d=https%3A%2F%2Fopbeat.com%2Fstatic%2Fimages%2Fcommon%2Favatars%2Favatar_default_user.png&size=180",- "240": "https://secure.gravatar.com/avatar/cf936cf5a05314e692830f4d17ec434e?d=https%3A%2F%2Fopbeat.com%2Fstatic%2Fimages%2Fcommon%2Favatars%2Favatar_default_user.png&size=240",- "120": "https://secure.gravatar.com/avatar/cf936cf5a05314e692830f4d17ec434e?d=https%3A%2F%2Fopbeat.com%2Fstatic%2Fimages%2Fcommon%2Favatars%2Favatar_default_user.png&size=120"- },- "html_url": "https://opbeat.com/account/settings/",- "type_name": "user"- },- "created": "2017-12-10T18:15:07Z",- "occurred": "2017-12-10T18:15:07Z",- "title": "foo marked E#2 as fixed",- "summary": "foo marked the error group as fixed",- "organization": {- "id": "f9a77c5e6b044c2686612539fe4a3a6f",- "name": "test_org",- "short_name": "test_org",- "url": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f",- "type_name": "organization"- },- "app": {- "id": "53daf84bfc",- "name": "Test-flask-app",- "short_name": "test-flask-app",- "url": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc",- "type_name": "app"- },- "subject_type": "errorgroup",- "subject": {- "id": "eac027998bc44fb0b2f6269eb0ab0418",- "number": 2,- "created": "2017-12-10T17:52:48Z",- "first_seen": "2017-12-10T17:52:47Z",- "last_seen": "2017-12-10T18:07:55Z",- "times_seen": {- "this_release": 10,- "total": 10,- "24h": 10.0,- "72h": 10.0- },- "url": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418",- "html_url": "https://opbeat.com/test_org/test-flask-app/errors/2/",- "links": {- "activities": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/activities",- "undo-mark-as-fixed": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/actions/undo-mark-fixed",- "mark-as-temporarily-ignored": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/actions/temporarily-ignore",- "comments": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/comments",- "mark-as-fixed": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/actions/mark-fixed",- "assignable-users": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/assignable-users",- "undo-mark-as-ignored": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/actions/undo-ignore",- "mark-as-ignored": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/actions/ignore",- "undo-mark-as-temporarily-ignored": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/actions/undo-temporarily-ignore",- "assign": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/actions/assign"- },- "last_occurrence": {- "id": "24210da90e5b4d659965b2e3ebf360f4",- "created": "2017-12-10T18:07:55Z",- "culprit": "",- "message": "A warning occurred (42 apples)",- "logger": "__main__",- "client_supplied_id": "13a4410d11724b30af92cd6ef1d556e8",- "extra": {- "thread": "140621113497408",- "process": "6120",- "threadName": "MainThread",- "stack_info": "None",- "module": "app",- "funcName": "foo",- "processName": "MainProcess",- "pathname": "app.py",- "lineno": "17",- "message": "A warning occurred (42 apples)",- "filename": "app.py"- },- "type_name": "errorlog"- },- "resolved_state": "fixed",- "allowed_resolve_transitions": [- "undo-mark-as-fixed",- "mark-as-regression"- ],- "is_alarm": false,- "num_comments": 4,- "is_expired": false,- "type_name": "errorgroup",- "first_error": {- "id": "24210da90e5b4d659965b2e3ebf360f4",- "created": "2017-12-10T18:07:55Z",- "culprit": "",- "message": "A warning occurred (42 apples)",- "logger": "__main__",- "client_supplied_id": "13a4410d11724b30af92cd6ef1d556e8",- "extra": {- "thread": "140621113497408",- "process": "6120",- "threadName": "MainThread",- "stack_info": "None",- "module": "app",- "funcName": "foo",- "processName": "MainProcess",- "pathname": "app.py",- "lineno": "17",- "message": "A warning occurred (42 apples)",- "filename": "app.py"- },- "type_name": "errorlog"- }- },- "action": "fixed",- "type_name": "activity"-}diff --git a/zerver/webhooks/opbeat/fixtures/error_reopen.json b/zerver/webhooks/opbeat/fixtures/error_reopen.jsondeleted file mode 100644index 53b1bb194df..00000000000--- a/zerver/webhooks/opbeat/fixtures/error_reopen.json+++ /dev/null@@ -1,123 +0,0 @@-{- "id": "38a556dfc0b04a59a586359bbce1463d",- "url": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/activities/38a556dfc0b04a59a586359bbce1463d",- "html_url": "https://opbeat.com/test_org/test-flask-app/errors/2/#activity-38a556dfc0b04a59a586359bbce1463d",- "author": {- "id": "5802edc6e84b4843b23edff00c6d300a",- "legacy_id": 14883,- "first_name": "foo",- "last_name": "E",- "email": "[email protected]",- "avatar": {- "40": "https://secure.gravatar.com/avatar/cf936cf5a05314e692830f4d17ec434e?d=https%3A%2F%2Fopbeat.com%2Fstatic%2Fimages%2Fcommon%2Favatars%2Favatar_default_user.png&size=40",- "80": "https://secure.gravatar.com/avatar/cf936cf5a05314e692830f4d17ec434e?d=https%3A%2F%2Fopbeat.com%2Fstatic%2Fimages%2Fcommon%2Favatars%2Favatar_default_user.png&size=80",- "180": "https://secure.gravatar.com/avatar/cf936cf5a05314e692830f4d17ec434e?d=https%3A%2F%2Fopbeat.com%2Fstatic%2Fimages%2Fcommon%2Favatars%2Favatar_default_user.png&size=180",- "240": "https://secure.gravatar.com/avatar/cf936cf5a05314e692830f4d17ec434e?d=https%3A%2F%2Fopbeat.com%2Fstatic%2Fimages%2Fcommon%2Favatars%2Favatar_default_user.png&size=240",- "120": "https://secure.gravatar.com/avatar/cf936cf5a05314e692830f4d17ec434e?d=https%3A%2F%2Fopbeat.com%2Fstatic%2Fimages%2Fcommon%2Favatars%2Favatar_default_user.png&size=120"- },- "html_url": "https://opbeat.com/account/settings/",- "type_name": "user"- },- "created": "2017-12-10T18:15:39Z",- "occurred": "2017-12-10T18:15:39Z",- "title": "foo reopened E#2",- "summary": "foo reopened the error group",- "organization": {- "id": "f9a77c5e6b044c2686612539fe4a3a6f",- "name": "test_org",- "short_name": "test_org",- "url": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f",- "type_name": "organization"- },- "app": {- "id": "53daf84bfc",- "name": "Test-flask-app",- "short_name": "test-flask-app",- "url": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc",- "type_name": "app"- },- "subject_type": "errorgroup",- "subject": {- "id": "eac027998bc44fb0b2f6269eb0ab0418",- "number": 2,- "created": "2017-12-10T17:52:48Z",- "first_seen": "2017-12-10T17:52:47Z",- "last_seen": "2017-12-10T18:07:55Z",- "times_seen": {- "this_release": 10,- "total": 10,- "24h": 10.0,- "72h": 10.0- },- "url": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418",- "html_url": "https://opbeat.com/test_org/test-flask-app/errors/2/",- "links": {- "activities": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/activities",- "undo-mark-as-fixed": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/actions/undo-mark-fixed",- "mark-as-temporarily-ignored": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/actions/temporarily-ignore",- "comments": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/comments",- "mark-as-fixed": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/actions/mark-fixed",- "assignable-users": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/assignable-users",- "undo-mark-as-ignored": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/actions/undo-ignore",- "mark-as-ignored": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/actions/ignore",- "undo-mark-as-temporarily-ignored": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/actions/undo-temporarily-ignore",- "assign": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/actions/assign"- },- "last_occurrence": {- "id": "24210da90e5b4d659965b2e3ebf360f4",- "created": "2017-12-10T18:07:55Z",- "culprit": "",- "message": "A warning occurred (42 apples)",- "logger": "__main__",- "client_supplied_id": "13a4410d11724b30af92cd6ef1d556e8",- "extra": {- "thread": "140621113497408",- "process": "6120",- "threadName": "MainThread",- "stack_info": "None",- "module": "app",- "funcName": "foo",- "processName": "MainProcess",- "pathname": "app.py",- "lineno": "17",- "message": "A warning occurred (42 apples)",- "filename": "app.py"- },- "type_name": "errorlog"- },- "resolved_state": "open",- "allowed_resolve_transitions": [- "mark-as-temporarily-ignored",- "mark-as-fixed",- "mark-as-ignored"- ],- "is_alarm": false,- "num_comments": 4,- "is_expired": false,- "type_name": "errorgroup",- "first_error": {- "id": "24210da90e5b4d659965b2e3ebf360f4",- "created": "2017-12-10T18:07:55Z",- "culprit": "",- "message": "A warning occurred (42 apples)",- "logger": "__main__",- "client_supplied_id": "13a4410d11724b30af92cd6ef1d556e8",- "extra": {- "thread": "140621113497408",- "process": "6120",- "threadName": "MainThread",- "stack_info": "None",- "module": "app",- "funcName": "foo",- "processName": "MainProcess",- "pathname": "app.py",- "lineno": "17",- "message": "A warning occurred (42 apples)",- "filename": "app.py"- },- "type_name": "errorlog"- }- },- "action": "reopened",- "type_name": "activity"-}diff --git a/zerver/webhooks/opbeat/fixtures/new_app.json b/zerver/webhooks/opbeat/fixtures/new_app.jsondeleted file mode 100644index cb5fffc80bc..00000000000--- a/zerver/webhooks/opbeat/fixtures/new_app.json+++ /dev/null@@ -1,37 +0,0 @@-{- "id": "47f1f10158d94cbf93a0b539abc64b0f",- "html_url": null,- "title": "foo",- "summary": "App foo created",- "organization": {- "id": "27a4c0633f5c4a24a15a8896754145c4",- "name": "bar",- "short_name": "bar",- "url": "https://opbeat.com/api/v2/organizations/27a4c0633f5c4a24a15a8896754145c4",- "type_name": "organization"- },- "app": {- "id": "bdb4751769",- "name": "foo",- "short_name": "foo",- "url": "https://opbeat.com/api/v2/organizations/27a4c0633f5c4a24a15a8896754145c4/apps/bdb4751769",- "type_name": "app"- },- "subject_type": "app",- "subject": {- "id": "bdb4751769",- "created": "2018-01-03T11:16:49Z",- "name": "foo",- "short_name": "foo",- "settings": null,- "url": "https://opbeat.com/api/v2/organizations/27a4c0633f5c4a24a15a8896754145c4/apps/bdb4751769",- "html_url": "/bar/foo/",- "has_unread_notifications": false,- "has_metrics_available": false,- "language": "nodejs",- "framework": "custom",- "type_name": "app"- },- "action": "created",- "type_name": "activity"-}diff --git a/zerver/webhooks/opbeat/fixtures/new_comment.json b/zerver/webhooks/opbeat/fixtures/new_comment.jsondeleted file mode 100644index 66c49f0af2f..00000000000--- a/zerver/webhooks/opbeat/fixtures/new_comment.json+++ /dev/null@@ -1,47 +0,0 @@-{- "id": "5df00003ea4e42458db48446692f6d37",- "html_url": "https://opbeat.com/foo/test-flask-app/errors/2/#activity-5df00003ea4e42458db48446692f6d37",- "author": {- "first_name": "foo",- "last_name": "bar"- },- "title": "foo commented on E#2",- "summary": "test comment",- "subject_type": "comment",- "subject": {- "id": "ca45bf96cd674b3eaa914251f0a08773",- "text": "test comment",- "author": {- "id": "5802edc6e84b4843b23edff00c6d300a",- "first_name": "foo",- "last_name": "barE"- },- "html_url": "https://opbeat.com/foo/test-flask-app/errors/2/#activity-5df00003ea4e42458db48446692f6d37",- "subject_type": "errorgroup",- "subject": {- "id": "eac027998bc44fb0b2f6269eb0ab0418",- "number": 2,- "html_url": "https://opbeat.com/foo/test-flask-app/errors/2/",- "last_occurrence": {- "id": "24210da90e5b4d659965b2e3ebf360f4",- "created": "2017-12-10T18:07:55Z",- "culprit": "",- "message": "A warning occurred (42 apples)",- "logger": "__main__",- "client_supplied_id": "13a4410d11724b30af92cd6ef1d556e8",- "extra": {- "module": "app",- "funcName": "foo",- "processName": "MainProcess",- "pathname": "app.py",- "lineno": "17",- "message": "A warning occurred (42 apples)"- },- "type_name": "errorlog"- }- },- "type_name": "comment"- },- "action": "created",- "type_name": "activity"-}diff --git a/zerver/webhooks/opbeat/fixtures/new_error.json b/zerver/webhooks/opbeat/fixtures/new_error.jsondeleted file mode 100644index 9047a44fb45..00000000000--- a/zerver/webhooks/opbeat/fixtures/new_error.json+++ /dev/null@@ -1,107 +0,0 @@-{- "id": "c0396f38323a4fa7b314f87d5ed9cdd2",- "url": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/activities/c0396f38323a4fa7b314f87d5ed9cdd2",- "html_url": "https://opbeat.com/test_org/test-flask-app/errors/2/#activity-c0396f38323a4fa7b314f87d5ed9cdd2",- "created": "2017-12-10T18:07:55Z",- "occurred": "2017-12-10T18:07:55Z",- "title": "E#2 regressed",- "summary": "The error group regressed",- "organization": {- "id": "f9a77c5e6b044c2686612539fe4a3a6f",- "name": "test_org",- "short_name": "test_org",- "url": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f",- "type_name": "organization"- },- "app": {- "id": "53daf84bfc",- "name": "Test-flask-app",- "short_name": "test-flask-app",- "url": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc",- "type_name": "app"- },- "subject_type": "errorgroup",- "subject": {- "id": "eac027998bc44fb0b2f6269eb0ab0418",- "number": 2,- "created": "2017-12-10T17:52:48Z",- "first_seen": "2017-12-10T17:52:47Z",- "last_seen": "2017-12-10T17:58:20Z",- "times_seen": {- "this_release": 10,- "total": 9,- "24h": 10.0,- "72h": 10.0- },- "url": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418",- "html_url": "https://opbeat.com/test_org/test-flask-app/errors/2/",- "links": {- "activities": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/activities",- "undo-mark-as-fixed": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/actions/undo-mark-fixed",- "mark-as-temporarily-ignored": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/actions/temporarily-ignore",- "comments": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/comments",- "mark-as-fixed": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/actions/mark-fixed",- "assignable-users": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/assignable-users",- "undo-mark-as-ignored": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/actions/undo-ignore",- "mark-as-ignored": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/actions/ignore",- "undo-mark-as-temporarily-ignored": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/actions/undo-temporarily-ignore",- "assign": "https://opbeat.com/api/v2/organizations/f9a77c5e6b044c2686612539fe4a3a6f/apps/53daf84bfc/errorgroups/eac027998bc44fb0b2f6269eb0ab0418/actions/assign"- },- "last_occurrence": {- "id": "24210da90e5b4d659965b2e3ebf360f4",- "created": "2017-12-10T18:07:55Z",- "culprit": "",- "message": "A warning occurred (42 apples)",- "logger": "__main__",- "client_supplied_id": "13a4410d11724b30af92cd6ef1d556e8",- "extra": {- "thread": "140621113497408",- "process": "6120",- "threadName": "MainThread",- "stack_info": "None",- "module": "app",- "funcName": "foo",- "processName": "MainProcess",- "pathname": "app.py",- "lineno": "17",- "message": "A warning occurred (42 apples)",- "filename": "app.py"- },- "type_name": "errorlog"- },- "resolved_state": "regressed",- "allowed_resolve_transitions": [- "mark-as-temporarily-ignored",- "mark-as-fixed",- "mark-as-ignored"- ],- "is_alarm": false,- "num_comments": 3,- "is_expired": false,- "type_name": "errorgroup",- "first_error": {- "id": "24210da90e5b4d659965b2e3ebf360f4",- "created": "2017-12-10T18:07:55Z",- "culprit": "",- "message": "A warning occurred (42 apples)",- "logger": "__main__",- "client_supplied_id": "13a4410d11724b30af92cd6ef1d556e8",- "extra": {- "thread": "140621113497408",- "process": "6120",- "threadName": "MainThread",- "stack_info": "None",- "module": "app",- "funcName": "foo",- "processName": "MainProcess",- "pathname": "app.py",- "lineno": "17",- "message": "A warning occurred (42 apples)",- "filename": "app.py"- },- "type_name": "errorlog"- }- },- "action": "regressed",- "type_name": "activity"-}diff --git a/zerver/webhooks/opbeat/fixtures/unsupported_object.json b/zerver/webhooks/opbeat/fixtures/unsupported_object.jsondeleted file mode 100644index 4f6ef0aec29..00000000000--- a/zerver/webhooks/opbeat/fixtures/unsupported_object.json+++ /dev/null@@ -1,30 +0,0 @@-{- "id": "47f1f10158d94cbf93a0b539abc64b0f",- "html_url": null,- "title": "test title",- "summary": "test summary",- "organization": {- "id": "27a4c0633f5c4a24a15a8896754145c4",- "name": "bar",- "short_name": "bar",- "url": "https://opbeat.com/api/v2/organizations/27a4c0633f5c4a24a15a8896754145c4",- "type_name": "organization"- },- "app": {- "id": "bdb4751769",- "name": "foo",- "short_name": "foo",- "url": "https://opbeat.com/api/v2/organizations/27a4c0633f5c4a24a15a8896754145c4/apps/bdb4751769",- "type_name": "app"- },- "subject_type": "foo",- "subject": {- "id": "bdb4751769",- "created": "2018-01-03T11:16:49Z",- "name": "foo",- "short_name": "foo",- "settings": null- },- "action": "created",- "type_name": "activity"-}diff --git a/zerver/webhooks/opbeat/tests.py b/zerver/webhooks/opbeat/tests.pydeleted file mode 100644index 6ef1f2e4a29..00000000000--- a/zerver/webhooks/opbeat/tests.py+++ /dev/null@@ -1,99 +0,0 @@-from zerver.lib.test_classes import WebhookTestCase-from zerver.lib.validator import wrap_wild_value-from zerver.webhooks.opbeat.view import get_value---class OpbeatHookTests(WebhookTestCase):- CHANNEL_NAME = "opbeat"- URL_TEMPLATE = "/api/v1/external/opbeat?api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "opbeat"-- def test_comment(self) -> None:- expected_topic_name = "foo commented on E#2"- expected_message = """\-**[foo commented on E#2](https://opbeat.com/foo/test-flask-app/errors/2/#activity-5df00003ea4e42458db48446692f6d37)**-test comment---**[E#2](https://opbeat.com/foo/test-flask-app/errors/2/)**-->**Most recent Occurrence**->in app.py->A warning occurred (42 apples)"""- self.check_webhook(- "new_comment", expected_topic_name, expected_message, content_type="application/json"- )-- def test_new_app(self) -> None:- expected_topic_name = "foo"- expected_message = """\-**foo**-App foo created--**[foo](https://opbeat.com/bar/foo/)**->language: nodejs->framework: custom"""- self.check_webhook(- "new_app", expected_topic_name, expected_message, content_type="application/json"- )-- def test_get_empty_value(self) -> None:- test_dictionary = wrap_wild_value("test_dictionary", {"key": "value"})- self.assertEqual(get_value(test_dictionary, "foo"), "")-- def test_no_subject_type(self) -> None:- expected_topic_name = "test title"- expected_message = """\-**test title**-test summary"""- self.check_webhook(- "unsupported_object",- expected_topic_name,- expected_message,- content_type="application/json",- )-- def test_error_fixed(self) -> None:- expected_topic_name = "foo marked E#2 as fixed"- expected_message = """\-**[foo marked E#2 as fixed](https://opbeat.com/test_org/test-flask-app/errors/2/#activity-bf991a45d9184b0ca6fb3d48d3db4c38)**-foo marked the error group as fixed--**[E#2](https://opbeat.com/test_org/test-flask-app/errors/2/)**-->**Most recent Occurrence**->in app.py->A warning occurred (42 apples)"""- self.check_webhook(- "error_fixed", expected_topic_name, expected_message, content_type="application/json"- )-- def test_error_reopened(self) -> None:- expected_topic_name = "foo reopened E#2"- expected_message = """\-**[foo reopened E#2](https://opbeat.com/test_org/test-flask-app/errors/2/#activity-38a556dfc0b04a59a586359bbce1463d)**-foo reopened the error group--**[E#2](https://opbeat.com/test_org/test-flask-app/errors/2/)**-->**Most recent Occurrence**->in app.py->A warning occurred (42 apples)"""- self.check_webhook(- "error_reopen", expected_topic_name, expected_message, content_type="application/json"- )-- def test_error_regressed(self) -> None:- expected_topic_name = "E#2 regressed"- expected_message = """\-**[E#2 regressed](https://opbeat.com/test_org/test-flask-app/errors/2/#activity-c0396f38323a4fa7b314f87d5ed9cdd2)**-The error group regressed--**[E#2](https://opbeat.com/test_org/test-flask-app/errors/2/)**-->**Most recent Occurrence**->in app.py->A warning occurred (42 apples)"""- self.check_webhook(- "new_error", expected_topic_name, expected_message, content_type="application/json"- )diff --git a/zerver/webhooks/opbeat/view.py b/zerver/webhooks/opbeat/view.pydeleted file mode 100644index 0bf5f9a064e..00000000000--- a/zerver/webhooks/opbeat/view.py+++ /dev/null@@ -1,121 +0,0 @@-# Webhooks for external integrations.--from django.http import HttpRequest, HttpResponse--from zerver.decorator import webhook_view-from zerver.lib.response import json_success-from zerver.lib.typed_endpoint import JsonBodyPayload, typed_endpoint-from zerver.lib.validator import WildValue, check_int, check_none_or, check_string, check_union-from zerver.lib.webhooks.common import check_send_webhook_message-from zerver.models import UserProfile--subject_types: dict[str, list[list[str]]] = {- "app": [ # Object type name- ["name"], # Title- ["html_url"], # Automatically put into title- ["language"], # Other properties.- ["framework"],- ],- "base": [- ["title"],- ["html_url"],- ["#summary"],- ["subject"],- ],- "comment": [- [""],- ["subject"],- ],- "errorgroup": [- ["E#{}", "number"],- ["html_url"],- ["last_occurrence:error"],- ],- "error": [- [""],- ['">**Most recent Occurrence**'],- ["in {}", "extra/pathname"],- ["!message"],- ],-}---def get_value(_obj: WildValue, key: str) -> str:- for _key in key.lstrip("!").split("/"):- if _key in _obj:- _obj = _obj[_key]- else:- return ""- return str(_obj.tame(check_union([check_string, check_int])))---def format_object(- obj: WildValue,- subject_type: str,- message: str,-) -> str:- if subject_type not in subject_types:- return message- keys: list[list[str]] = subject_types[subject_type][1:]- title = subject_types[subject_type][0]- if title[0] != "":- title_str = ""- if len(title) > 1:- title_str = title[0].format(get_value(obj, title[1]))- else:- title_str = obj[title[0]].tame(check_string)-- url = obj["html_url"].tame(check_none_or(check_string))- if url is not None:- if "opbeat.com" not in url:- url = "https://opbeat.com/" + url.lstrip("/")- message += f"\n**[{title_str}]({url})**"- else:- message += f"\n**{title_str}**"- for key_list in keys:- if len(key_list) > 1:- value = key_list[0].format(get_value(obj, key_list[1]))- message += f"\n>{value}"- else:- key = key_list[0]- key_raw = key.lstrip("!").lstrip("#").lstrip('"')- if key_raw not in {"html_url", "subject"} and ":" not in key_raw:- value = get_value(obj, key_raw)- if key.startswith("!"):- message += f"\n>{value}"- elif key.startswith("#"):- message += f"\n{value}"- elif key.startswith('"'):- message += f"\n{key_raw}"- else:- message += f"\n>{key}: {value}"- if key == "subject":- message = format_object(- obj["subject"], obj["subject_type"].tame(check_string), message + "\n"- )- if ":" in key:- value, value_type = key.split(":")- message = format_object(obj[value], value_type, message + "\n")- return message---@webhook_view("Opbeat")-@typed_endpoint-def api_opbeat_webhook(- request: HttpRequest,- user_profile: UserProfile,- *,- payload: JsonBodyPayload[WildValue],-) -> HttpResponse:- """- This uses the subject name from opbeat to make the topic,- and the summary from Opbeat as the message body, with- details about the object mentioned.- """-- topic_name = payload["title"].tame(check_string)-- message = format_object(payload, "base", "")-- check_send_webhook_message(request, user_profile, topic_name, message)- return json_success(request)