plainx-sentry 0.5.1__py3-none-any.whl → 0.6.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.
@@ -4,9 +4,9 @@ from sentry_sdk.tracing import TransactionSource
4
4
  from sentry_sdk.utils import capture_internal_exceptions
5
5
 
6
6
  try:
7
- from plain.models.db import connection
7
+ from plain.models.db import db_connection
8
8
  except ImportError:
9
- connection = None
9
+ db_connection = None
10
10
 
11
11
  import logging
12
12
 
@@ -19,11 +19,11 @@ def trace_db(execute, sql, params, many, context):
19
19
  data = {
20
20
  "db.params": params,
21
21
  "db.executemany": many,
22
- "db.system": connection.vendor,
23
- "db.name": connection.settings_dict.get("NAME"),
24
- "db.user": connection.settings_dict.get("USER"),
25
- "server.address": connection.settings_dict.get("HOST"),
26
- "server.port": connection.settings_dict.get("PORT"),
22
+ "db.system": db_connection.vendor,
23
+ "db.name": db_connection.settings_dict.get("NAME"),
24
+ "db.user": db_connection.settings_dict.get("USER"),
25
+ "server.address": db_connection.settings_dict.get("HOST"),
26
+ "server.port": db_connection.settings_dict.get("PORT"),
27
27
  }
28
28
 
29
29
  sentry_sdk.add_breadcrumb(message=sql, category="query", data=data)
@@ -81,9 +81,9 @@ class SentryMiddleware:
81
81
  with sentry_sdk.start_transaction(
82
82
  op="http.server", name=request.path_info
83
83
  ) as transaction:
84
- if connection:
84
+ if db_connection:
85
85
  # Also get spans for db queries
86
- with connection.execute_wrapper(trace_db):
86
+ with db_connection.execute_wrapper(trace_db):
87
87
  response = self.get_response(request)
88
88
  else:
89
89
  # No db presumably
@@ -95,7 +95,9 @@ class SentryMiddleware:
95
95
  transaction.name = f"route:{resolver_match.route}"
96
96
  transaction.set_tag("url_namespace", resolver_match.namespace)
97
97
  transaction.set_tag("url_name", resolver_match.url_name)
98
- transaction.set_tag("view_class", resolver_match.view.view_class.__qualname__)
98
+ transaction.set_tag(
99
+ "view_class", resolver_match.view.view_class.__qualname__
100
+ )
99
101
 
100
102
  # Don't need to filter on this, but do want the context to view
101
103
  transaction.set_context(
@@ -137,9 +139,9 @@ class SentryWorkerMiddleware:
137
139
  name=f"job:{job.job_class}",
138
140
  source=TransactionSource.TASK,
139
141
  ) as transaction:
140
- if connection:
142
+ if db_connection:
141
143
  # Also get spans for db queries
142
- with connection.execute_wrapper(trace_db):
144
+ with db_connection.execute_wrapper(trace_db):
143
145
  job_result = self.run_job(job)
144
146
  else:
145
147
  # No db presumably
@@ -35,9 +35,9 @@ class SentryJSExtension(InclusionTagExtension):
35
35
  sentry_context["sentry_init"]["initialScope"] = {"user": {"id": user.id}}
36
36
  if settings.SENTRY_PII_ENABLED:
37
37
  if email := getattr(user, "email", None):
38
- sentry_context["sentry_init"]["initialScope"]["user"][
39
- "email"
40
- ] = email
38
+ sentry_context["sentry_init"]["initialScope"]["user"]["email"] = (
39
+ email
40
+ )
41
41
  if username := getattr(user, "username", None):
42
42
  sentry_context["sentry_init"]["initialScope"]["user"][
43
43
  "username"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plainx-sentry
3
- Version: 0.5.1
3
+ Version: 0.6.0
4
4
  Author-email: Dave Gaeddert <dave.gaeddert@gmail.com>
5
5
  Requires-Python: >=3.11
6
6
  Requires-Dist: sentry-sdk>=2.24.0
@@ -1,9 +1,9 @@
1
1
  plainx/sentry/__init__.py,sha256=Klz3mH_itM2RXzJ_sWWJRIoZcS0jCRxWrhVVIPsG5FY,123
2
2
  plainx/sentry/config.py,sha256=EwMnY3DaanIGkgtKD_4h8ncx6MH_MxOML8BF5Hx5GBA,723
3
3
  plainx/sentry/default_settings.py,sha256=DNX6OQ0-BqfjyWuszW7JnZhiDn0tGtS3Fa2W7VbTIF8,564
4
- plainx/sentry/middleware.py,sha256=mwL2lCQ3VFO-p2HcUUWonE3T0jRxaG6U8V-8jaIPwqk,6019
5
- plainx/sentry/templates.py,sha256=YovKIswcsjLRjHdmRzdaxG1PHjGfz8fc5TeNE9wcYQA,2046
4
+ plainx/sentry/middleware.py,sha256=gGLxsRFHGJ5f6yLnpMnz8p7AnUnhg1I_vkd0bHtSKic,6098
5
+ plainx/sentry/templates.py,sha256=ARLvITEyrOQjnuuRkdHvQT0bCar1ya2j-wueDjC4tu4,2048
6
6
  plainx/sentry/templates/sentry/js.html,sha256=aOjWAwuUaecGbC-5yZWP1aaGyYAcM-GK0dru-4VOYoE,491
7
- plainx_sentry-0.5.1.dist-info/METADATA,sha256=wvogxQWvJPdlPPZoVuG6PmiihQseUGm12G8yLeB2770,1559
8
- plainx_sentry-0.5.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
- plainx_sentry-0.5.1.dist-info/RECORD,,
7
+ plainx_sentry-0.6.0.dist-info/METADATA,sha256=4_qF1CiLjhjFJ4WBjoLzq-aRHFo4_Qe6vlsR9SdTVwQ,1559
8
+ plainx_sentry-0.6.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
+ plainx_sentry-0.6.0.dist-info/RECORD,,