plainx-sentry 0.1.0__py3-none-any.whl → 0.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
plainx/sentry/config.py CHANGED
@@ -1,10 +1,10 @@
1
1
  import sentry_sdk
2
- from plain.packages import PackageConfig
2
+ from plain.packages import PackageConfig, register_config
3
3
  from plain.runtime import settings
4
4
 
5
5
 
6
+ @register_config
6
7
  class PlainxSentryConfig(PackageConfig):
7
- name = "plainx.sentry"
8
8
  label = "plainxsentry"
9
9
 
10
10
  def ready(self):
@@ -1,8 +1,10 @@
1
1
  import sentry_sdk
2
2
  from plain.runtime import settings
3
+ from plain.templates import register_template_extension
3
4
  from plain.templates.jinja.extensions import InclusionTagExtension
4
5
 
5
6
 
7
+ @register_template_extension
6
8
  class SentryJSExtension(InclusionTagExtension):
7
9
  tags = {"sentry_js"}
8
10
  template_name = "sentry/js.html"
@@ -44,6 +46,7 @@ class SentryJSExtension(InclusionTagExtension):
44
46
  return sentry_context
45
47
 
46
48
 
49
+ @register_template_extension
47
50
  class SentryFeedbackExtension(SentryJSExtension):
48
51
  tags = {"sentry_feedback"}
49
52
 
@@ -51,9 +54,3 @@ class SentryFeedbackExtension(SentryJSExtension):
51
54
  context = super().get_context(context, *args, **kwargs)
52
55
  context["sentry_dialog_event_id"] = sentry_sdk.last_event_id()
53
56
  return context
54
-
55
-
56
- extensions = [
57
- SentryJSExtension,
58
- SentryFeedbackExtension,
59
- ]
@@ -0,0 +1,76 @@
1
+ Metadata-Version: 2.4
2
+ Name: plainx-sentry
3
+ Version: 0.3.0
4
+ Author-email: Dave Gaeddert <dave.gaeddert@gmail.com>
5
+ Requires-Python: >=3.11
6
+ Requires-Dist: sentry-sdk>=1.8.0
7
+ Description-Content-Type: text/markdown
8
+
9
+ # plainx-sentry
10
+
11
+ Use [Sentry](https://sentry.io/) to monitor errors and performance in your Plain application.
12
+
13
+ ![image](https://user-images.githubusercontent.com/649496/213781768-182322e6-edf0-4d98-8b37-ab564ef23c3b.png)
14
+
15
+ ## Installation
16
+
17
+ ```python
18
+ # settings.py
19
+ INSTALLED_PACKAGES = [
20
+ # ...
21
+ "plainx.sentry",
22
+ ]
23
+
24
+ MIDDLEWARE = [
25
+ # Put SentryMiddleware as early as possible in the middleware stack
26
+ "plainx.sentry.SentryMiddleware",
27
+ # ...
28
+ ]
29
+ ```
30
+
31
+ In your `base.html`, load `sentry` and include the `sentry_js` tag:
32
+
33
+ ```html
34
+ <!-- base.html -->
35
+ <!doctype html>
36
+ <html lang="en">
37
+ <head>
38
+ ...
39
+ {% sentry_js %}
40
+ </head>
41
+ <body>
42
+ ...
43
+ </body>
44
+ </html>
45
+ ```
46
+
47
+ To enable Sentry in production, add the `SENTRY_DSN` to your environment.
48
+ In Heroku, for example:
49
+
50
+ ```sh
51
+ heroku config:set SENTRY_DSN=<your-DSN>
52
+ ```
53
+
54
+ ## Configuration
55
+
56
+ [Look at the `default_settings.py` for all available settings.](./plainx/sentry/default_settings.py)
57
+
58
+ ## Error page feedback widget
59
+
60
+ In your `500.html`, you can optionally use the `sentry_feedback` tag to show Sentry's feedback widget:
61
+
62
+ ```html
63
+ <!-- base.html -->
64
+ <!doctype html>
65
+ <html lang="en">
66
+ <head>
67
+ ...
68
+ {% sentry_feedback %}
69
+ </head>
70
+ <body>
71
+ ...
72
+ </body>
73
+ </html>
74
+ ```
75
+
76
+ ![image](https://user-images.githubusercontent.com/649496/213781811-418500fa-b7f8-43f1-8d28-4fde1bfe2b4b.png)
@@ -0,0 +1,9 @@
1
+ plainx/sentry/__init__.py,sha256=Klz3mH_itM2RXzJ_sWWJRIoZcS0jCRxWrhVVIPsG5FY,123
2
+ plainx/sentry/config.py,sha256=EwMnY3DaanIGkgtKD_4h8ncx6MH_MxOML8BF5Hx5GBA,723
3
+ plainx/sentry/default_settings.py,sha256=DNX6OQ0-BqfjyWuszW7JnZhiDn0tGtS3Fa2W7VbTIF8,564
4
+ plainx/sentry/middleware.py,sha256=tw2ZMBRfH7eze0ZDqxo-meLSOaD2lVUSBYC99z5izZs,5597
5
+ plainx/sentry/templates.py,sha256=YovKIswcsjLRjHdmRzdaxG1PHjGfz8fc5TeNE9wcYQA,2046
6
+ plainx/sentry/templates/sentry/js.html,sha256=aOjWAwuUaecGbC-5yZWP1aaGyYAcM-GK0dru-4VOYoE,491
7
+ plainx_sentry-0.3.0.dist-info/METADATA,sha256=o15WLvI7N7Rq4sxqujNbM5_XUAreCd71bixd54f2GJo,1558
8
+ plainx_sentry-0.3.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
+ plainx_sentry-0.3.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.8.1
2
+ Generator: hatchling 1.27.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,11 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: plainx-sentry
3
- Version: 0.1.0
4
- Summary:
5
- Author: Dave Gaeddert
6
- Author-email: dave.gaeddert@dropseed.dev
7
- Requires-Python: >=3.11,<4.0
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.11
10
- Classifier: Programming Language :: Python :: 3.12
11
- Requires-Dist: sentry-sdk (>=1.8.0,<2.0.0)
@@ -1,9 +0,0 @@
1
- plainx/sentry/__init__.py,sha256=Klz3mH_itM2RXzJ_sWWJRIoZcS0jCRxWrhVVIPsG5FY,123
2
- plainx/sentry/config.py,sha256=pxvKwy6V7aYmZLe2tA7DiQF84R1ovvBMR0rE0CVFT1Y,716
3
- plainx/sentry/default_settings.py,sha256=DNX6OQ0-BqfjyWuszW7JnZhiDn0tGtS3Fa2W7VbTIF8,564
4
- plainx/sentry/jinja.py,sha256=hI6g65GQpaP_-LesTiXINeH7YyNdOYRJUSMQ1pnjQfA,2003
5
- plainx/sentry/middleware.py,sha256=tw2ZMBRfH7eze0ZDqxo-meLSOaD2lVUSBYC99z5izZs,5597
6
- plainx/sentry/templates/sentry/js.html,sha256=aOjWAwuUaecGbC-5yZWP1aaGyYAcM-GK0dru-4VOYoE,491
7
- plainx_sentry-0.1.0.dist-info/METADATA,sha256=sNoU_R76H5uYQVKLhG0HrxEib-xPAPOa58Ie5Y1HQNI,352
8
- plainx_sentry-0.1.0.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
9
- plainx_sentry-0.1.0.dist-info/RECORD,,