Skip to content
Snippets Groups Projects
Commit 88980cab authored by Andrew Kapuscinski's avatar Andrew Kapuscinski
Browse files

Add sentry error tracing to services

parent e857561b
No related branches found
No related tags found
1 merge request!692Add sentry error tracing to services
Pipeline #3826 passed
......@@ -82,3 +82,6 @@ edu.nrao.carta.redisHost = noplace.nrao.edu
edu.nrao.carta.reverseProxyHost = black-abyss.nrao.edu
edu.nrao.carta.redisPort = 6397
edu.nrao.carta.redisPassword = password
# Sentry.io Settings
edu.nrao.workspaces.SentrySettings.sentry_key = local
......@@ -15,15 +15,18 @@
#
# You should have received a copy of the GNU General Public License
# along with Workspaces. If not, see <https://www.gnu.org/licenses/>.
import sentry_sdk
import sqlalchemy.orm
import transaction
import zope.sqlalchemy
from pycapo import CapoConfig
from pyramid.config import Configurator
from pyramid.events import NewRequest
from pyramid.renderers import JSONP
from pyramid.request import Request
from pyramid.response import Response
from pyramid_beaker import BeakerSessionFactoryConfig, session_factory_from_settings
from sentry_sdk.integrations.pyramid import PyramidIntegration
from workspaces.capability.services.capability_info import CapabilityInfo
from workspaces.capability.services.capability_service import (
......@@ -38,6 +41,17 @@ from workspaces.system.schema import get_engine, get_session_factory
from workspaces.system.services.archive_service import ArchiveService
from workspaces.workflow.services.workflow_service import WorkflowServiceRESTClient
sentry_key = CapoConfig().settings("edu.nrao.workspaces.SentrySettings").sentry_key
if sentry_key != "local":
sentry_sdk.init(
dsn=sentry_key,
integrations=[PyramidIntegration()],
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
# We recommend adjusting this value in production.
traces_sample_rate=1.0,
)
# Copied from here: https://stackoverflow.com/questions/21107057/pyramid-cors-for-ajax-requests
def add_cors_headers_response_callback(event: NewRequest):
......
......@@ -68,6 +68,7 @@ requires = [
"ssa-workspaces",
"zope.sqlalchemy",
"immutable_views",
"sentry-sdk",
]
setup(
......
......@@ -15,20 +15,35 @@
#
# You should have received a copy of the GNU General Public License
# along with Workspaces. If not, see <https://www.gnu.org/licenses/>.
import sentry_sdk
import sqlalchemy.orm
import transaction
import zope.sqlalchemy
from pycapo import CapoConfig
from pyramid.config import Configurator
from pyramid.events import NewRequest
from pyramid.renderers import JSONP
from pyramid.request import Request
from pyramid.response import Response
from pyramid_beaker import BeakerSessionFactoryConfig, session_factory_from_settings
from sentry_sdk.integrations.pyramid import PyramidIntegration
from workspaces.notification.services.notification_info import NotificationInfo
from workspaces.notification.services.notification_service import NotificationService
from workspaces.system.schema import get_engine, get_session_factory
sentry_key = CapoConfig().settings("edu.nrao.workspaces.SentrySettings").sentry_key
if sentry_key != "local":
sentry_sdk.init(
dsn=sentry_key,
integrations=[PyramidIntegration()],
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
# We recommend adjusting this value in production.
traces_sample_rate=1.0,
)
# ---------------------------------------------------------
#
# S E R V I C E S
......
......@@ -66,6 +66,7 @@ requires = [
"waitress",
"ssa-workspaces",
"zope.sqlalchemy",
"sentry-sdk",
]
# Setup comment
......
......@@ -66,6 +66,7 @@ requires = [
"ssa-workspaces",
"zope.sqlalchemy",
"immutable_views",
"sentry-sdk",
]
# Setup comment
......
......@@ -15,6 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with Workspaces. If not, see <https://www.gnu.org/licenses/>.
# pylint: disable=E0401
""" This is our workflow server API. """
import http
import json
......@@ -22,14 +23,17 @@ import logging
import os
from pathlib import Path
import sentry_sdk
import transaction
import zope.sqlalchemy
from pycapo import CapoConfig
from pyramid.config import Configurator
from pyramid.renderers import JSONP
from pyramid.request import Request
from pyramid.response import FileResponse, Response
from pyramid.view import view_config, view_defaults
from pyramid_beaker import session_factory_from_settings
from sentry_sdk.integrations.pyramid import PyramidIntegration
from workspaces.system.schema import get_engine, get_session_factory
from workspaces.workflow.schema import Workflow, WorkflowRequest, WorkflowRequestFile
......@@ -39,7 +43,17 @@ from workspaces.workflow.services.workflow_service import (
WorkflowService,
)
# pylint: disable=E0401
sentry_key = CapoConfig().settings("edu.nrao.workspaces.SentrySettings").sentry_key
if sentry_key != "local":
sentry_sdk.init(
dsn=sentry_key,
integrations=[PyramidIntegration()],
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
# We recommend adjusting this value in production.
traces_sample_rate=1.0,
)
logger = logging.getLogger(__name__)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment