mirror of
https://github.com/Xtao-Labs/misskey2telegram.git
synced 2024-11-25 14:55:19 +00:00
46 lines
1.2 KiB
Python
46 lines
1.2 KiB
Python
from subprocess import run, PIPE
|
|
from time import time
|
|
|
|
import sentry_sdk
|
|
from pyrogram import Client
|
|
from sentry_sdk.integrations.aiohttp import AioHttpIntegration
|
|
from sentry_sdk.integrations.httpx import HttpxIntegration
|
|
from sentry_sdk.integrations.logging import LoggingIntegration
|
|
from sentry_sdk.integrations.redis import RedisIntegration
|
|
from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration
|
|
|
|
from glover import sentry_dsn
|
|
|
|
sentry_sdk_report_time = time()
|
|
sentry_sdk_git_hash = (
|
|
run("git rev-parse HEAD", stdout=PIPE, shell=True, check=True)
|
|
.stdout.decode()
|
|
.strip()
|
|
)
|
|
sentry_sdk.init(
|
|
sentry_dsn,
|
|
send_default_pii=True,
|
|
traces_sample_rate=1.0,
|
|
release=sentry_sdk_git_hash,
|
|
environment="production",
|
|
integrations=[
|
|
AioHttpIntegration(),
|
|
HttpxIntegration(),
|
|
LoggingIntegration(),
|
|
RedisIntegration(),
|
|
SqlalchemyIntegration(),
|
|
],
|
|
)
|
|
|
|
|
|
async def sentry_init_id(bot: Client):
|
|
if not bot.me:
|
|
bot.me = await bot.get_me()
|
|
data = {
|
|
"id": bot.me.id,
|
|
"username": bot.me.username,
|
|
"name": bot.me.first_name,
|
|
"ip_address": "{{auto}}",
|
|
}
|
|
sentry_sdk.set_user(data)
|