Skip to content

Commit

Permalink
update sentry config to add sentry releases (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
sumit4613 authored Nov 21, 2020
1 parent 5dc1b44 commit 8c1fcb2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
BOT_TOKEN=
SENTRY_DSN=
SENTRY_ENV=
SENTRY_RELEASE=
8 changes: 8 additions & 0 deletions kick_members.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,26 @@
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__)

# 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
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pyTelegramBotAPI==3.7.3
python-dotenv==0.14.0
sentry-sdk==0.19.1
sentry-sdk==0.19.4

0 comments on commit 8c1fcb2

Please sign in to comment.