Skip to content

Commit

Permalink
feat: distinct sentry init for api app
Browse files Browse the repository at this point in the history
  • Loading branch information
stchris committed Jan 8, 2025
1 parent 9305ace commit dfe636f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
16 changes: 0 additions & 16 deletions aleph/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,12 @@
from werkzeug.local import LocalProxy
from werkzeug.middleware.profiler import ProfilerMiddleware

from aleph import __version__ as aleph_version
from aleph.settings import SETTINGS
from aleph.cache import Cache
from aleph.oauth import configure_oauth
from aleph.util import LoggingTransport
from aleph.metrics.flask import PrometheusExtension

import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration


NONE = "'none'"
log = logging.getLogger(__name__)
Expand Down Expand Up @@ -67,18 +63,6 @@ def create_app(config=None):
config = {}

configure_logging(level=logging.DEBUG)

if SETTINGS.SENTRY_DSN and not sentry_sdk.get_client().is_active():
sentry_sdk.init(
dsn=SETTINGS.SENTRY_DSN,
integrations=[
FlaskIntegration(),
],
traces_sample_rate=0,
release=aleph_version,
environment=SETTINGS.SENTRY_ENVIRONMENT,
send_default_pii=False,
)
app = Flask("aleph")
app.config.from_object(SETTINGS)
app.config.update(config)
Expand Down
17 changes: 17 additions & 0 deletions aleph/wsgi.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
from aleph.core import create_app
from aleph.settings import SETTINGS
from aleph import __version__ as aleph_version

import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration


if SETTINGS.SENTRY_DSN:
sentry_sdk.init(
dsn=SETTINGS.SENTRY_DSN,
integrations=[
FlaskIntegration(),
],
traces_sample_rate=0,
release=aleph_version,
environment=SETTINGS.SENTRY_ENVIRONMENT,
send_default_pii=False,
)
app = create_app()

0 comments on commit dfe636f

Please sign in to comment.