Skip to content

Commit

Permalink
feat: rm sentry code
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyqu committed May 20, 2024
1 parent 3adb76e commit 67e0af8
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 25 deletions.
2 changes: 1 addition & 1 deletion .isort.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[settings]
known_third_party = apiclient,bs4,conftest,dateutil,deepdiff,facebook,fakes,freezegun,googleapiclient,matplotlib,numpy,oauth2client,pytest,pytest_report,requests,schedule,sentry_sdk,setuptools,sheetfu,sqlalchemy,telegram,telethon,utils,vk_api
known_third_party = apiclient,bs4,conftest,dateutil,deepdiff,facebook,fakes,freezegun,googleapiclient,matplotlib,numpy,oauth2client,pytest,pytest_report,requests,schedule,setuptools,sheetfu,sqlalchemy,telegram,telethon,utils,vk_api
6 changes: 0 additions & 6 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import logging

import requests
import sentry_sdk

from src import consts
from src.bot import SysBlokBot
Expand Down Expand Up @@ -34,10 +33,6 @@ def get_bot():
if not config:
raise ValueError("Could not load config, can't go on")

sentry_dsn = config.get("sentry_dsn", None)
if sentry_dsn:
sentry_sdk.init(dsn=sentry_dsn, traces_sample_rate=1.0)

scheduler = JobScheduler()

jobs_config_file_key = ConfigManager().get_jobs_config_file_key()
Expand Down Expand Up @@ -82,7 +77,6 @@ def get_bot():


def report_critical_error(e: BaseException):
sentry_sdk.capture_exception(e)
requests.post(
url=f"https://api.telegram.org/bot{consts.TELEGRAM_TOKEN}/sendMessage",
json={
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ retrying==1.3.3
rope==0.17.0
rsa==4.0
-e git+https://github.com/dbader/schedule.git@3eac646a8d2658929587d7454bd2c85696df254e#egg=schedule
sentry-sdk==1.10.1
sheetfu==1.5.3
six==1.14.0
soupsieve==2.3.2.post1
Expand Down
17 changes: 0 additions & 17 deletions src/utils/log_handler.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import html
from logging import ERROR, Formatter, LogRecord, StreamHandler

from sentry_sdk import capture_message

from ..consts import LOG_FORMAT, USAGE_LOG_LEVEL
from ..tg.sender import TelegramSender
from .singleton import Singleton
Expand Down Expand Up @@ -49,21 +47,6 @@ def emit(self, record: LogRecord):
error_message = f"{record.levelname} - {record.module} - {record.message}"
if record.exc_text:
error_message += f" - {record.exc_text}"
try:
capture_message(error_message)
except Exception as e:
# if it can't send a message, still should log it to the stream
super().emit(
LogRecord(
name=__name__,
level=ERROR,
pathname=None,
lineno=-1,
msg="Failed to capture sentry log",
args=None,
exc_info=e,
)
)
try:
self.tg_sender.send_error_log(
f"<code>{html.escape(error_message)}</code>"
Expand Down

0 comments on commit 67e0af8

Please sign in to comment.