add sentry error tracking

This commit is contained in:
Benny 2023-04-26 22:22:30 +02:00
parent cddc37ff7e
commit ffcfcea46e
No known key found for this signature in database
GPG key ID: 6CD0DBDA5235D481
4 changed files with 13 additions and 1 deletions

View file

@ -11,7 +11,7 @@ flower==1.2.0
psutil==5.9.5
influxdb==5.3.1
beautifulsoup4==4.12.2
fakeredis==2.10.3
fakeredis==2.11.1
supervisor==4.2.5
tgbot-ping==1.0.7
redis==4.5.4
@ -22,3 +22,4 @@ ffpb==0.4.1
youtube-search-python==1.6.6
token-bucket==0.3.0
coloredlogs==15.0.1
sentry-sdk==1.21.0

View file

@ -62,3 +62,5 @@ FREE_DOWNLOAD = os.getenv("FREE_DOWNLOAD", 5)
TOKEN_PRICE = os.getenv("BUY_UNIT", 20) # one USD=20 credits
RATE_LIMIT = os.getenv("RATE_LIMIT", 10)
DSN = os.getenv("DSN")

View file

@ -26,18 +26,21 @@ import filetype
import psutil
import pyrogram.errors
import requests
import sentry_sdk
from apscheduler.schedulers.background import BackgroundScheduler
from celery import Celery
from celery.worker.control import Panel
from pyrogram import Client, idle, types
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
from requests_toolbelt import MultipartEncoder, MultipartEncoderMonitor
from sentry_sdk.integrations.celery import CeleryIntegration
from channel import Channel
from client_init import create_app
from config import (
ARCHIVE_ID,
BROKER,
DSN,
ENABLE_CELERY,
ENABLE_QUEUE,
ENABLE_VIP,
@ -71,6 +74,8 @@ channel = Channel()
session = "ytdl-celery"
celery_client = create_app(session)
if DSN:
sentry_sdk.init(DSN, integrations=[CeleryIntegration()])
def get_messages(chat_id, message_id):

View file

@ -17,6 +17,7 @@ import typing
from io import BytesIO
import pyrogram.errors
import sentry_sdk
from apscheduler.schedulers.background import BackgroundScheduler
from pyrogram import Client, filters, types
from pyrogram.errors.exceptions.bad_request_400 import UserNotParticipant
@ -29,6 +30,7 @@ from channel import Channel
from client_init import create_app
from config import (
AUTHORIZED_USER,
DSN,
ENABLE_CELERY,
ENABLE_FFMPEG,
ENABLE_VIP,
@ -60,6 +62,8 @@ app = create_app(session)
logging.info("Authorized users are %s", AUTHORIZED_USER)
redis = Redis()
channel = Channel()
if DSN:
sentry_sdk.init(dsn=DSN)
def private_use(func):