diff --git a/acoustid/cli.py b/acoustid/cli.py index c3166750..d20dfe56 100644 --- a/acoustid/cli.py +++ b/acoustid/cli.py @@ -33,7 +33,6 @@ def run_web_cmd(config, workers=None, threads=None): os.environ["ACOUSTID_CONFIG"] = config script = Script(config) script.setup_console_logging() - script.setup_sentry() run_web_app(script.config, workers=workers, threads=threads) @@ -47,7 +46,6 @@ def run_api_cmd(config, workers=None, threads=None): os.environ["ACOUSTID_CONFIG"] = config script = Script(config) script.setup_console_logging() - script.setup_sentry() run_api_app(script.config, workers=workers, threads=threads) @@ -57,7 +55,6 @@ def run_cron_cmd(config: str) -> None: """Run cron.""" script = Script(config) script.setup_console_logging() - script.setup_sentry() run_cron(script) @@ -67,7 +64,6 @@ def run_worker_cmd(config: str) -> None: """Run worker.""" script = Script(config) script.setup_console_logging() - script.setup_sentry() run_worker(script) @@ -78,7 +74,6 @@ def run_import_cmd(config): """Run import.""" script = Script(config) script.setup_console_logging(verbose=True) - script.setup_sentry() run_import(script) @@ -90,7 +85,6 @@ def run_script_cmd(name, config): """Run a built-in script.""" script = Script(config) script.setup_console_logging() - script.setup_sentry() mod = importlib.import_module("acoustid.scripts.{}".format(name)) func_name = "run_{}".format(name) func = getattr(mod, func_name) @@ -106,7 +100,6 @@ def shell_cmd(config): script = Script(config) script.setup_console_logging() - script.setup_sentry() with script.context() as ctx: _ = ctx IPython.embed() diff --git a/acoustid/config.py b/acoustid/config.py index a70e1ff1..d05c63ba 100644 --- a/acoustid/config.py +++ b/acoustid/config.py @@ -453,27 +453,6 @@ def read_env(self, prefix): ) -class SentryConfig(BaseConfig): - def __init__(self): - self.web_dsn = "" - self.api_dsn = "" - self.script_dsn = "" - - def read_section(self, parser, section): - # type: (RawConfigParser, str) -> None - if parser.has_option(section, "web_dsn"): - self.web_dsn = parser.get(section, "web_dsn") - if parser.has_option(section, "api_dsn"): - self.api_dsn = parser.get(section, "api_dsn") - if parser.has_option(section, "script_dsn"): - self.script_dsn = parser.get(section, "script_dsn") - - def read_env(self, prefix): - read_env_item(self, "web_dsn", prefix + "SENTRY_WEB_DSN") - read_env_item(self, "api_dsn", prefix + "SENTRY_API_DSN") - read_env_item(self, "script_dsn", prefix + "SENTRY_SCRIPT_DSN") - - class StatsdConfig(BaseConfig): def __init__(self): # type: () -> None @@ -572,7 +551,6 @@ def __init__(self): self.replication = ReplicationConfig() self.cluster = ClusterConfig() self.rate_limiter = RateLimiterConfig() - self.sentry = SentryConfig() self.gunicorn = GunicornConfig() self.statsd = StatsdConfig() @@ -589,7 +567,6 @@ def read(self, path): self.replication.read(parser, "replication") self.cluster.read(parser, "cluster") self.rate_limiter.read(parser, "rate_limiter") - self.sentry.read(parser, "sentry") self.gunicorn.read(parser, "gunicorn") self.statsd.read(parser, "statsd") @@ -607,6 +584,5 @@ def read_env(self, tests=False): self.replication.read_env(prefix) self.cluster.read_env(prefix) self.rate_limiter.read_env(prefix) - self.sentry.read_env(prefix) self.gunicorn.read_env(prefix) self.statsd.read_env(prefix) diff --git a/acoustid/script.py b/acoustid/script.py index 1ab9decb..fb0b9218 100644 --- a/acoustid/script.py +++ b/acoustid/script.py @@ -6,7 +6,6 @@ from optparse import OptionParser from typing import Any, Optional -import sentry_sdk from redis import Redis from redis.sentinel import Sentinel as RedisSentinel from statsd import StatsClient @@ -121,12 +120,6 @@ def setup_console_logging(self, quiet=False, verbose=False): logging.getLogger().addHandler(handler) self._console_logging_configured = True - def setup_sentry(self): - # type: () -> None - sentry_sdk.init( - self.config.sentry.script_dsn, release=GIT_RELEASE, sample_rate=0.01 - ) - def context(self, use_two_phase_commit=None): # type: (Optional[bool]) -> ScriptContext db = DatabaseContext(self, use_two_phase_commit=use_two_phase_commit) @@ -156,7 +149,6 @@ def run_script(func, option_cb=None, master_only=False): parser.error("no configuration file") script = Script(options.config) script.setup_console_logging(options.quiet) - script.setup_sentry() if master_only and script.config.cluster.role != "master": logger.debug("Not running script %s on a slave server", sys.argv[0]) else: diff --git a/acoustid/server.py b/acoustid/server.py index 72f8ab58..ce8bf5a3 100644 --- a/acoustid/server.py +++ b/acoustid/server.py @@ -7,8 +7,6 @@ import os from typing import TYPE_CHECKING, Any, Callable, Iterable, List, Optional, Tuple -import sentry_sdk -from sentry_sdk.integrations.wsgi import SentryWsgiMiddleware from six import BytesIO from werkzeug.exceptions import BadRequest, ClientDisconnected, HTTPException from werkzeug.middleware.proxy_fix import ProxyFix @@ -136,9 +134,6 @@ def wsgi_app( return e(environ, start_response) return response(environ, start_response) - def setup_sentry(self) -> None: - sentry_sdk.init(self.config.sentry.api_dsn, release=GIT_RELEASE) - class GzipRequestMiddleware(object): """WSGI middleware to handle GZip-compressed HTTP requests bodies @@ -210,7 +205,6 @@ def make_application(config_path=None): config_path = os.environ.get("ACOUSTID_CONFIG", "") assert config_path is not None server = Server(config_path) - server.setup_sentry() server.wsgi_app = GzipRequestMiddleware(server.wsgi_app) # type: ignore server.wsgi_app = SentryWsgiMiddleware(server.wsgi_app) # type: ignore server.wsgi_app = replace_double_slashes(server.wsgi_app) # type: ignore diff --git a/acoustid/web/app.py b/acoustid/web/app.py index aa5a987e..40d49819 100644 --- a/acoustid/web/app.py +++ b/acoustid/web/app.py @@ -1,10 +1,8 @@ import os import pickle -import sentry_sdk from flask import Flask, request, session from flask.sessions import SecureCookieSessionInterface -from sentry_sdk.integrations.flask import FlaskIntegration from werkzeug.middleware.proxy_fix import ProxyFix from acoustid._release import GIT_RELEASE @@ -43,10 +41,6 @@ def make_application(config_filename=None, tests=False): app.wsgi_app = ProxyFix(app.wsgi_app) - sentry_sdk.init( - config.sentry.web_dsn, release=GIT_RELEASE, integrations=[FlaskIntegration()] - ) - # can't use json because of python-openid app.session_interface = SecureCookieSessionInterface() app.session_interface.serializer = pickle diff --git a/mypy.ini b/mypy.ini index 738be382..1bea3a60 100644 --- a/mypy.ini +++ b/mypy.ini @@ -7,9 +7,6 @@ ignore_missing_imports = True [mypy-markdown.*] ignore_missing_imports = True -[mypy-sentry_sdk.*] -ignore_missing_imports = True - [mypy-schedule] ignore_missing_imports = True diff --git a/requirements.in b/requirements.in index 1d4dfc07..60c197b5 100644 --- a/requirements.in +++ b/requirements.in @@ -17,7 +17,6 @@ pyasn1 mbdata==25.0.0 alembic>=0.8.4,<1.7 schedule -sentry-sdk[flask] typing six subprocess32; python_version < "3.2"