Disable sentry dev (#1902)

* Disable sentry on dev env

* Offload env
This commit is contained in:
Pascal Vizeli 2020-08-13 09:39:26 +02:00 committed by GitHub
parent fb5d54d5fe
commit f5dda39f63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -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,

View File

@ -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"