From 8c1fcb224a4ff6743fac22aa690f6e94cf168836 Mon Sep 17 00:00:00 2001 From: Sumit Singh Date: Sat, 21 Nov 2020 10:55:48 +0530 Subject: [PATCH] update sentry config to add sentry releases (#9) --- .env.example | 1 + kick_members.py | 8 ++++++++ requirements.txt | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index ce37419..6850b0b 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,4 @@ BOT_TOKEN= SENTRY_DSN= SENTRY_ENV= +SENTRY_RELEASE= diff --git a/kick_members.py b/kick_members.py index 75bb7fe..299830c 100644 --- a/kick_members.py +++ b/kick_members.py @@ -10,6 +10,7 @@ import sentry_sdk import telebot from dotenv import load_dotenv +from sentry_sdk.integrations.logging import LoggingIntegration from telebot.apihelper import ApiTelegramException logger = logging.getLogger(__name__) @@ -17,11 +18,18 @@ # initialize dot env load_dotenv() +sentry_logging = LoggingIntegration( + level=logging.INFO, # Capture info and above as breadcrumbs + event_level=logging.ERROR, # Send errors as events +) + # initialize sentry sentry_sdk.init( dsn=os.getenv("SENTRY_DSN"), environment=os.getenv("SENTRY_ENV"), + release=os.getenv("SENTRY_RELEASE"), traces_sample_rate=1.0, + integrations=[sentry_logging], ) # load BOT_TOKEN from env file diff --git a/requirements.txt b/requirements.txt index b568c54..c99619c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ pyTelegramBotAPI==3.7.3 python-dotenv==0.14.0 -sentry-sdk==0.19.1 +sentry-sdk==0.19.4