Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate sentry into the django project #408

Merged
merged 5 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions dockerize/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,8 @@ QGISPLUGINS_ENV=debug
# Ldap
ENABLE_LDAP=False

# SENTRY
SENTRY_DSN=''

# Download stats URL
METABASE_DOWNLOAD_STATS_URL='https://plugins.qgis.org/metabase/public/dashboard/<dashboard_id>'
2 changes: 1 addition & 1 deletion dockerize/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ services:
- EMAIL_HOST_USER=${EMAIL_HOST_USER:-automation}
- EMAIL_HOST_PASSWORD=${EMAIL_HOST_PASSWORD}
- DEFAULT_PLUGINS_SITE=${DEFAULT_PLUGINS_SITE:-https://plugins.qgis.org/}

- SENTRY_DSN=${SENTRY_DSN}
volumes:
- ../qgis-app:/home/web/django_project
- ./docker/uwsgi.conf:/uwsgi.conf
Expand Down
2 changes: 2 additions & 0 deletions dockerize/docker/REQUIREMENTS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ geoip2==4.5.0
django-matomo==0.1.6
uwsgi~=2.0
freezegun~=1.4

sentry-sdk~=2.2
16 changes: 12 additions & 4 deletions qgis-app/plugins/tests/test_plugin_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,13 @@ def test_plugin_new_version(self):
self.assertEqual(self.plugin.tracker, "https://github.com/")
self.assertEqual(self.plugin.repository, "https://github.com/")

self.assertEqual(
self.assertIn(
'[email protected]',
mail.outbox[0].recipients(),
['[email protected]', '[email protected]']
)
self.assertIn(
'[email protected]',
mail.outbox[0].recipients()
)

# Should use the new email
Expand Down Expand Up @@ -145,9 +149,13 @@ def test_plugin_version_update(self):
self.assertEqual(self.plugin.tracker, "https://github.com/")
self.assertEqual(self.plugin.repository, "https://github.com/")

self.assertEqual(
self.assertIn(
'[email protected]',
mail.outbox[0].recipients(),
['[email protected]', '[email protected]']
)
self.assertIn(
'[email protected]',
mail.outbox[0].recipients()
)

# Should use the new email
Expand Down
8 changes: 6 additions & 2 deletions qgis-app/plugins/tests/test_plugin_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,13 @@ def test_plugin_upload_form(self):
3)
self.assertTrue(PluginVersion.objects.filter(plugin__name='Test Plugin', version='0.0.1').exists())

self.assertEqual(
self.assertIn(
'[email protected]',
mail.outbox[0].recipients(),
['[email protected]', '[email protected]']
)
self.assertIn(
'[email protected]',
mail.outbox[0].recipients()
)

# Should use the new email
Expand Down
Binary file modified qgis-app/plugins/tests/testfiles/valid_metadata_link.zip
Binary file not shown.
14 changes: 14 additions & 0 deletions qgis-app/settings_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,17 @@

# Default primary key type
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'


# Sentry
SENTRY_DSN = os.environ.get("SENTRY_DSN", "")

dimasciput marked this conversation as resolved.
Show resolved Hide resolved
if SENTRY_DSN and SENTRY_DSN != "":
import sentry_sdk

sentry_sdk.init(
dsn=SENTRY_DSN,
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
traces_sample_rate=1.0,
)