Fix sentry message with unsupported (#1890)

* Fix sentry message with unsupported

* filter breadcrumb

* Support add-on errors

* Fix level

* Add logging info
This commit is contained in:
Pascal Vizeli 2020-08-11 16:48:58 +02:00 committed by GitHub
parent 71ccaa2bd0
commit e5fc985915
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -98,6 +98,7 @@ class AddonManager(CoreSysAttributes):
await addon.start()
except Exception as err: # pylint: disable=broad-except
_LOGGER.warning("Can't start Add-on %s: %s", addon.slug, err)
self.sys_capture_exception(err)
await asyncio.sleep(self.sys_config.wait_boot)
@ -121,6 +122,7 @@ class AddonManager(CoreSysAttributes):
await addon.stop()
except Exception as err: # pylint: disable=broad-except
_LOGGER.warning("Can't stop Add-on %s: %s", addon.slug, err)
self.sys_capture_exception(err)
async def install(self, slug: str) -> None:
"""Install an add-on."""

View File

@ -280,6 +280,7 @@ def supervisor_debugger(coresys: CoreSys) -> None:
def setup_diagnostics(coresys: CoreSys) -> None:
"""Sentry diagnostic backend."""
_LOGGER.info("Initialize Supervisor Sentry")
def filter_data(event, hint):
# Ignore issue if system is not supported or diagnostics is disabled
@ -319,12 +320,14 @@ def setup_diagnostics(coresys: CoreSys) -> None:
# Set log level
sentry_logging = LoggingIntegration(
level=logging.ERROR, event_level=logging.CRITICAL
level=logging.WARNING, event_level=logging.CRITICAL
)
sentry_sdk.init(
dsn="https://9c6ea70f49234442b4746e447b24747e@o427061.ingest.sentry.io/5370612",
before_send=filter_data,
before_breadcrumb=filter_data,
max_breadcrumbs=20,
integrations=[AioHttpIntegration(), sentry_logging],
release=SUPERVISOR_VERSION,
)