Add Sentry integration

This commit is contained in:
2025-02-10 22:22:54 +01:00
parent ce14ff1e2d
commit 61ed2ea2c9
3 changed files with 23 additions and 7 deletions

View File

@ -2,7 +2,13 @@
"python.analysis.typeCheckingMode": "standard", "python.analysis.typeCheckingMode": "standard",
"cSpell.words": [ "cSpell.words": [
"botuser", "botuser",
"docstrings",
"dotenv", "dotenv",
"fastapi",
"httpx",
"isort",
"pycodestyle",
"pydocstyle",
"pyproject", "pyproject",
"PYTHONDONTWRITEBYTECODE", "PYTHONDONTWRITEBYTECODE",
"PYTHONUNBUFFERED", "PYTHONUNBUFFERED",

View File

@ -5,6 +5,7 @@ from pathlib import Path
from typing import Annotated from typing import Annotated
from urllib.parse import urljoin from urllib.parse import urljoin
import sentry_sdk
from fastapi import FastAPI, File, Request, UploadFile from fastapi import FastAPI, File, Request, UploadFile
from fastapi.responses import HTMLResponse, JSONResponse from fastapi.responses import HTMLResponse, JSONResponse
@ -12,6 +13,13 @@ from discord_embed.settings import serve_domain, upload_folder, webhook_url
from discord_embed.video_file_upload import do_things from discord_embed.video_file_upload import do_things
from discord_embed.webhook import send_webhook from discord_embed.webhook import send_webhook
sentry_sdk.init(
dsn="https://61f2ac51bc9083592bab1e3794305ec0@o4505228040339456.ingest.us.sentry.io/4508796999434240",
send_default_pii=True,
traces_sample_rate=1.0,
_experiments={"continuous_profiling_auto_start": True},
)
app: FastAPI = FastAPI( app: FastAPI = FastAPI(
title="discord-nice-embed", title="discord-nice-embed",
contact={ contact={

View File

@ -5,12 +5,13 @@ description = "Make nice embeds for Discord"
readme = "README.md" readme = "README.md"
requires-python = ">=3.13" requires-python = ">=3.13"
dependencies = [ dependencies = [
"discord-webhook",
"fastapi", "fastapi",
"ffmpeg-python", "ffmpeg-python",
"discord-webhook",
"python-multipart",
"python-dotenv",
"Jinja2", "Jinja2",
"python-dotenv",
"python-multipart",
"sentry-sdk[fastapi]",
"uvicorn[standard]", "uvicorn[standard]",
] ]
@ -30,12 +31,13 @@ license = "GPL-3.0-or-later"
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.13" python = "^3.13"
discord-webhook = "*"
fastapi = "*" fastapi = "*"
ffmpeg-python = "*" ffmpeg-python = "*"
discord-webhook = "*"
python-multipart = "*"
python-dotenv = "*"
Jinja2 = "*" Jinja2 = "*"
python-dotenv = "*"
python-multipart = "*"
sentry-sdk = {extras = ["fastapi"], version = "*"}
uvicorn = {extras = ["standard"], version = "*"} uvicorn = {extras = ["standard"], version = "*"}
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
@ -48,7 +50,6 @@ lint.select = ["ALL"]
lint.pydocstyle.convention = "google" lint.pydocstyle.convention = "google"
lint.isort.required-imports = ["from __future__ import annotations"] lint.isort.required-imports = ["from __future__ import annotations"]
lint.pycodestyle.ignore-overlong-task-comments = true lint.pycodestyle.ignore-overlong-task-comments = true
line-length = 120
lint.ignore = [ lint.ignore = [
"CPY001", # Checks for the absence of copyright notices within Python files. "CPY001", # Checks for the absence of copyright notices within Python files.
@ -75,6 +76,7 @@ lint.ignore = [
"Q003", # Checks for strings that include escaped quotes, and suggests changing the quote style to avoid the need to escape them. "Q003", # Checks for strings that include escaped quotes, and suggests changing the quote style to avoid the need to escape them.
"W191", # Checks for indentation that uses tabs. "W191", # Checks for indentation that uses tabs.
] ]
line-length = 120
[tool.ruff.lint.per-file-ignores] [tool.ruff.lint.per-file-ignores]
"**/test_*.py" = [ "**/test_*.py" = [