feat: add sentry sdk
This commit is contained in:
parent
a60d83311b
commit
b7214b5d46
14 changed files with 86 additions and 12 deletions
|
@ -6,7 +6,7 @@ APP := playout
|
|||
PIP_INSTALL := \
|
||||
--editable ../api-client \
|
||||
--editable ../shared \
|
||||
--editable .[dev]
|
||||
--editable .[dev,sentry]
|
||||
PYLINT_ARG := libretime_playout tests
|
||||
MYPY_ARG := libretime_playout tests || true
|
||||
BANDIT_ARG := libretime_playout || true
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""
|
||||
Python part of radio playout (pypo)
|
||||
"""
|
||||
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
from datetime import datetime
|
||||
|
@ -18,6 +18,7 @@ from libretime_shared.cli import cli_config_options, cli_logging_options
|
|||
from libretime_shared.config import DEFAULT_ENV_PREFIX
|
||||
from libretime_shared.logging import setup_logger
|
||||
|
||||
from . import PACKAGE, VERSION
|
||||
from .config import CACHE_DIR, RECORD_DIR, Config
|
||||
from .history.stats import StatsCollectorThread
|
||||
from .liquidsoap.client import LiquidsoapClient
|
||||
|
@ -75,6 +76,16 @@ def cli(
|
|||
setup_logger(log_level, log_filepath)
|
||||
config = Config(config_filepath)
|
||||
|
||||
if "SENTRY_DSN" in os.environ:
|
||||
logger.info("installing sentry")
|
||||
# pylint: disable=import-outside-toplevel
|
||||
import sentry_sdk
|
||||
|
||||
sentry_sdk.init(
|
||||
traces_sample_rate=1.0,
|
||||
release=f"{PACKAGE}@{VERSION}",
|
||||
)
|
||||
|
||||
try:
|
||||
for dir_path in [CACHE_DIR, RECORD_DIR]:
|
||||
dir_path.mkdir(exist_ok=True)
|
||||
|
|
|
@ -41,6 +41,9 @@ setup(
|
|||
"types-python-dateutil>=2.8.1,<2.9",
|
||||
"types-requests>=2.25.1,<2.29",
|
||||
],
|
||||
"sentry": [
|
||||
"sentry-sdk>=1.15.0,<1.16",
|
||||
],
|
||||
},
|
||||
zip_safe=False,
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue