Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

integrations/sentry: Use global time.

Niloth Pa25445bf27fc
diff --git a/static/images/integrations/sentry/001.png b/static/images/integrations/sentry/001.png
index ddb463130d3..129831ed9a7 100644
Binary files a/static/images/integrations/sentry/001.png and b/static/images/integrations/sentry/001.png differ
diff --git a/zerver/webhooks/sentry/tests.py b/zerver/webhooks/sentry/tests.py
index 60dbe9211df..9da41ab7173 100644
--- a/zerver/webhooks/sentry/tests.py
+++ b/zerver/webhooks/sentry/tests.py
@@ -12,7 +12,7 @@ class SentryHookTests(WebhookTestCase):
**New exception:** [*url.Error: Get "bad_url": unsupported protocol scheme ""](https://sentry.io/organizations/hypro999-personal-organization/issues/1637164584/events/80777a9cc30e4d0eb8904333d5c298b0/)
```quote
**level:** error
-**timestamp:** 2020-04-29 11:23:45
+**timestamp:** <time:2020-04-29 11:23:45>
**filename:** trigger-exception.go
```
@@ -38,7 +38,7 @@ Traceback:
**New exception:** [Error: Sample error from node.](https://sentry.io/organizations/hypro999-personal-organization/issues/1638852747/events/f9cb0f2afff74a5aa92e766fb7ac3fe3/)
```quote
**level:** error
-**timestamp:** 2020-04-30 06:19:33
+**timestamp:** <time:2020-04-30 06:19:33>
**filename:** /home/hemanth/Desktop/sentry/trigger-exception.js
```
@@ -64,7 +64,7 @@ Traceback:
**New exception:** [Exception: Custom exception!](https://sentry.io/organizations/hypro999-personal-organization/issues/1635244907/events/599349254a1447a99774b5310711c1a8/)
```quote
**level:** error
-**timestamp:** 2020-04-28 13:56:05
+**timestamp:** <time:2020-04-28 13:56:05>
**filename:** trigger-exception.py
```
@@ -88,7 +88,7 @@ Traceback:
**New exception:** [ZeroDivisionError: divided by 0](https://sentry.io/organizations/nitk-46/issues/4213933362/events/49b528e13e45497ab9adc3173fd2ed34/)
```quote
**level:** error
-**timestamp:** 2023-05-29 10:12:33
+**timestamp:** <time:2023-05-29 10:12:33>
**filename:** app/controllers/articles_controller.rb
```
@@ -117,7 +117,7 @@ Traceback:
**New exception:** [TypeError: Cannot read properties of null (reading 'insertBefore')](https://sentry.io/organizations/nitk-46/issues/4214010673/events/292f78454e774e62999506f759ad791d/)
```quote
**level:** error
-**timestamp:** 2023-05-29 11:08:30
+**timestamp:** <time:2023-05-29 11:08:30>
**filename:** /node_modules/.vite/deps/chunk-G4DFXOZZ.js
```"""
self.check_webhook("event_for_exception_vue", expected_topic_name, expected_message)
@@ -128,7 +128,7 @@ Traceback:
**New exception:** [ValueError: new sentry error.](https://sentry.io/organizations/bar-foundation/issues/1972208801/events/c916dccfd58e41dcabaebef0091f0736/)
```quote
**level:** error
-**timestamp:** 2020-10-21 23:25:11
+**timestamp:** <time:2020-10-21 23:25:11>
**filename:** trigger-exception.py
```
@@ -153,7 +153,7 @@ Traceback:
**New exception:** [TypeError: can't access property "bar", x.foo is undefined](https://sentry.io/organizations/foo-bar-org/issues/1982047746/events/f3bf5fc4e354451db9e885a69b2a2b51/)
```quote
**level:** error
-**timestamp:** 2020-10-26 16:39:54
+**timestamp:** <time:2020-10-26 16:39:54>
**filename:** None
```"""
self.check_webhook(
@@ -166,7 +166,7 @@ Traceback:
**New exception:** [Error: Something external broke.](https://sentry.io/organizations/hypro999-personal-organization/issues/1731239773/events/355c3b2a142046629dd410db2fdda003/)
```quote
**level:** error
-**timestamp:** 2020-06-17 14:42:54
+**timestamp:** <time:2020-06-17 14:42:54>
**filename:** /mnt/data/Documents/Stuff%20for%20Zulip/Repos/sentry/js/external.js
```"""
self.check_webhook("event_for_exception_js", expected_topic_name, expected_message)
@@ -177,7 +177,7 @@ Traceback:
**New message event:** [A test message event from golang.](https://sentry.io/organizations/hypro999-personal-organization/issues/1638844654/events/01ecb45633bc4f5ca940ada671124c8f/)
```quote
**level:** info
-**timestamp:** 2020-04-30 06:14:13
+**timestamp:** <time:2020-04-30 06:14:13>
```"""
self.check_webhook("event_for_message_golang", expected_topic_name, expected_message)
@@ -187,7 +187,7 @@ Traceback:
**New message event:** [Test event from node.](https://sentry.io/organizations/hypro999-personal-organization/issues/1638840427/events/6886bb1fe7ce4497b7836f6083d5fd34/)
```quote
**level:** info
-**timestamp:** 2020-04-30 06:09:56
+**timestamp:** <time:2020-04-30 06:09:56>
```"""
self.check_webhook("event_for_message_node", expected_topic_name, expected_message)
@@ -197,7 +197,7 @@ Traceback:
**New message event:** [A simple message-based issue.](https://sentry.io/organizations/hypro999-personal-organization/issues/1635261062/events/8da63b42375e4d3b803c377fefb062f8/)
```quote
**level:** info
-**timestamp:** 2020-04-28 14:05:04
+**timestamp:** <time:2020-04-28 14:05:04>
```"""
self.check_webhook("event_for_message_python", expected_topic_name, expected_message)
@@ -217,7 +217,7 @@ Traceback:
**New issue created:** Exception: Custom exception!
```quote
**level:** error
-**timestamp:** 2020-04-28 13:56:05
+**timestamp:** <time:2020-04-28 13:56:05>
**assignee:** No one
```"""
self.check_webhook("issue_created_for_exception", expected_topic_name, expected_message)
@@ -228,7 +228,7 @@ Traceback:
**New issue created:** A simple message-based issue.
```quote
**level:** info
-**timestamp:** 2020-04-28 14:05:04
+**timestamp:** <time:2020-04-28 14:05:04>
**assignee:** No one
```"""
self.check_webhook("issue_created_for_message", expected_topic_name, expected_message)
@@ -259,7 +259,7 @@ This is an example python exception
**New message event:** [This is an example Python exception](https://sentry.io/organizations/nitk-46/issues/4218258981/events/b6eff1a49b1f4132850b1238d968da70/)
```quote
**level:** error
-**timestamp:** 2023-05-31 11:06:16
+**timestamp:** <time:2023-05-31 11:06:16>
```"""
self.check_webhook("sample_event_through_alert", expected_topic_name, expected_message)
@@ -269,7 +269,7 @@ This is an example python exception
**New message event:** [This is an example Python exception](https://nitk-46.sentry.io/issues/4218258981/events/4dc4fc2858aa450eb658be9e5b8ad149/)
```quote
**level:** error
-**timestamp:** 2023-07-09 20:41:24
+**timestamp:** <time:2023-07-09 20:41:24>
```"""
self.check_webhook("sample_event_through_plugin", expected_topic_name, expected_message)
diff --git a/zerver/webhooks/sentry/view.py b/zerver/webhooks/sentry/view.py
index c292f4d9e1c..327fcd98f39 100644
--- a/zerver/webhooks/sentry/view.py
+++ b/zerver/webhooks/sentry/view.py
@@ -24,7 +24,7 @@ MESSAGE_EVENT_TEMPLATE = """
**New message event:** [{title}]({web_link})
```quote
**level:** {level}
-**timestamp:** {datetime}
+**timestamp:** <time:{datetime}>
```
"""
@@ -32,7 +32,7 @@ EXCEPTION_EVENT_TEMPLATE = """
**New exception:** [{title}]({web_link})
```quote
**level:** {level}
-**timestamp:** {datetime}
+**timestamp:** <time:{datetime}>
**filename:** {filename}
```
"""
@@ -53,7 +53,7 @@ ISSUE_CREATED_MESSAGE_TEMPLATE = """
**New issue created:** {title}
```quote
**level:** {level}
-**timestamp:** {datetime}
+**timestamp:** <time:{datetime}>
**assignee:** {assignee}
```
"""