diff --git a/dockerize/.env.template b/dockerize/.env.template index 8cbf8dc8..5175f3ff 100644 --- a/dockerize/.env.template +++ b/dockerize/.env.template @@ -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/' diff --git a/dockerize/docker-compose.yml b/dockerize/docker-compose.yml index 387fd96d..5fd84d1e 100644 --- a/dockerize/docker-compose.yml +++ b/dockerize/docker-compose.yml @@ -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 diff --git a/dockerize/docker/REQUIREMENTS.txt b/dockerize/docker/REQUIREMENTS.txt index 3d738ad9..24146e93 100644 --- a/dockerize/docker/REQUIREMENTS.txt +++ b/dockerize/docker/REQUIREMENTS.txt @@ -60,3 +60,5 @@ geoip2==4.5.0 django-matomo==0.1.6 uwsgi~=2.0 freezegun~=1.4 + +sentry-sdk~=2.2 diff --git a/qgis-app/plugins/tests/test_plugin_update.py b/qgis-app/plugins/tests/test_plugin_update.py index d1e4c34b..118b12d8 100644 --- a/qgis-app/plugins/tests/test_plugin_update.py +++ b/qgis-app/plugins/tests/test_plugin_update.py @@ -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( + 'admin@admin.it', mail.outbox[0].recipients(), - ['admin@admin.it', 'staff@staff.it'] + ) + self.assertIn( + 'staff@staff.it', + mail.outbox[0].recipients() ) # Should use the new email @@ -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( + 'admin@admin.it', mail.outbox[0].recipients(), - ['admin@admin.it', 'staff@staff.it'] + ) + self.assertIn( + 'staff@staff.it', + mail.outbox[0].recipients() ) # Should use the new email diff --git a/qgis-app/plugins/tests/test_plugin_upload.py b/qgis-app/plugins/tests/test_plugin_upload.py index 9b3d2814..f2819ea9 100644 --- a/qgis-app/plugins/tests/test_plugin_upload.py +++ b/qgis-app/plugins/tests/test_plugin_upload.py @@ -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( + 'admin@admin.it', mail.outbox[0].recipients(), - ['admin@admin.it', 'staff@staff.it'] + ) + self.assertIn( + 'staff@staff.it', + mail.outbox[0].recipients() ) # Should use the new email diff --git a/qgis-app/plugins/tests/testfiles/valid_metadata_link.zip b/qgis-app/plugins/tests/testfiles/valid_metadata_link.zip index 94ca6c67..6c53b039 100644 Binary files a/qgis-app/plugins/tests/testfiles/valid_metadata_link.zip and b/qgis-app/plugins/tests/testfiles/valid_metadata_link.zip differ diff --git a/qgis-app/settings_docker.py b/qgis-app/settings_docker.py index 9d8fcacf..4b5bd1f4 100644 --- a/qgis-app/settings_docker.py +++ b/qgis-app/settings_docker.py @@ -165,3 +165,17 @@ # Default primary key type DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' + + +# Sentry +SENTRY_DSN = os.environ.get("SENTRY_DSN", "") + +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, + )