From f5dda39f631e9f236f079b8bce79294778275d3b Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Thu, 13 Aug 2020 09:39:26 +0200 Subject: [PATCH] Disable sentry dev (#1902) * Disable sentry on dev env * Offload env --- supervisor/bootstrap.py | 8 +++++--- supervisor/const.py | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/supervisor/bootstrap.py b/supervisor/bootstrap.py index 65dd15e8d..ba8b67b71 100644 --- a/supervisor/bootstrap.py +++ b/supervisor/bootstrap.py @@ -16,6 +16,7 @@ from .arch import CpuArch from .auth import Auth from .const import ( ENV_HOMEASSISTANT_REPOSITORY, + ENV_SUPERVISOR_DEV, ENV_SUPERVISOR_MACHINE, ENV_SUPERVISOR_NAME, ENV_SUPERVISOR_SHARE, @@ -169,7 +170,7 @@ def initialize_system_data(coresys: CoreSys) -> None: coresys.config.modify_log_level() # Check if ENV is in development mode - if bool(os.environ.get("SUPERVISOR_DEV", 0)): + if bool(os.environ.get(ENV_SUPERVISOR_DEV, 0)): _LOGGER.warning("SUPERVISOR_DEV is set") coresys.updater.channel = UpdateChannels.DEV coresys.config.logging = LogLevel.DEBUG @@ -280,11 +281,11 @@ def supervisor_debugger(coresys: CoreSys) -> None: def setup_diagnostics(coresys: CoreSys) -> None: """Sentry diagnostic backend.""" - _LOGGER.info("Initialize Supervisor Sentry") + dev_env: bool = bool(os.environ.get(ENV_SUPERVISOR_DEV, 0)) def filter_data(event, hint): # Ignore issue if system is not supported or diagnostics is disabled - if not coresys.config.diagnostics or not coresys.supported: + if not coresys.config.diagnostics or not coresys.supported or dev_env: return None # Not full startup - missing information @@ -325,6 +326,7 @@ def setup_diagnostics(coresys: CoreSys) -> None: level=logging.WARNING, event_level=logging.CRITICAL ) + _LOGGER.info("Initialize Supervisor Sentry") sentry_sdk.init( dsn="https://9c6ea70f49234442b4746e447b24747e@o427061.ingest.sentry.io/5370612", before_send=filter_data, diff --git a/supervisor/const.py b/supervisor/const.py index 960680bc2..73b101b0d 100644 --- a/supervisor/const.py +++ b/supervisor/const.py @@ -74,6 +74,7 @@ ENV_HOMEASSISTANT_REPOSITORY = "HOMEASSISTANT_REPOSITORY" ENV_SUPERVISOR_SHARE = "SUPERVISOR_SHARE" ENV_SUPERVISOR_NAME = "SUPERVISOR_NAME" ENV_SUPERVISOR_MACHINE = "SUPERVISOR_MACHINE" +ENV_SUPERVISOR_DEV = "SUPERVISOR_DEV" REQUEST_FROM = "HASSIO_FROM"