mirror of
https://github.com/revanced/revanced-api.git
synced 2025-05-02 15:44:33 +02:00
feat(observability): sentry
This commit is contained in:
parent
cf45b08d5b
commit
99e645c5f5
9
.vscode/settings.json
vendored
9
.vscode/settings.json
vendored
@ -1,3 +1,10 @@
|
|||||||
{
|
{
|
||||||
"python.analysis.typeCheckingMode": "off"
|
"python.analysis.typeCheckingMode": "off",
|
||||||
|
"spellright.language": [
|
||||||
|
"pt"
|
||||||
|
],
|
||||||
|
"spellright.documentTypes": [
|
||||||
|
"markdown",
|
||||||
|
"latex"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
FROM python:3.11-slim
|
FROM python:3.11-slim
|
||||||
|
|
||||||
ARG GITHUB_TOKEN
|
ARG GITHUB_TOKEN
|
||||||
|
ARG SENTRY_DSN
|
||||||
|
|
||||||
ENV GITHUB_TOKEN $GITHUB_TOKEN
|
ENV GITHUB_TOKEN $GITHUB_TOKEN
|
||||||
|
ENV SENTRY_DSN $SENTRY_DSN
|
||||||
|
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
19
app.py
19
app.py
@ -1,19 +1,34 @@
|
|||||||
# app.py
|
# app.py
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
from sanic import Sanic
|
from sanic import Sanic
|
||||||
import sanic.response
|
import sanic.response
|
||||||
from sanic_ext import Config
|
from sanic_ext import Config
|
||||||
|
|
||||||
from api import api
|
from api import api
|
||||||
from config import *
|
from config import openapi_title, openapi_version, openapi_description
|
||||||
|
|
||||||
from limiter import configure_limiter
|
from limiter import configure_limiter
|
||||||
from auth import configure_auth
|
from auth import configure_auth
|
||||||
|
|
||||||
|
import sentry_sdk
|
||||||
|
|
||||||
|
if os.environ.get("SENTRY_DSN"):
|
||||||
|
sentry_sdk.init(
|
||||||
|
dsn=os.environ["SENTRY_DSN"],
|
||||||
|
enable_tracing=True,
|
||||||
|
traces_sample_rate=1.0,
|
||||||
|
debug=True,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
print("WARNING: Sentry DSN not set, not enabling Sentry")
|
||||||
|
|
||||||
REDIRECTS = {
|
REDIRECTS = {
|
||||||
"/": "/docs/swagger",
|
"/": "/docs/swagger",
|
||||||
}
|
}
|
||||||
|
|
||||||
app = Sanic("ReVanced-API")
|
app = Sanic("revanced-api")
|
||||||
app.extend(config=Config(oas_ignore_head=False))
|
app.extend(config=Config(oas_ignore_head=False))
|
||||||
app.ext.openapi.describe(
|
app.ext.openapi.describe(
|
||||||
title=openapi_title,
|
title=openapi_title,
|
||||||
|
@ -8,8 +8,8 @@ readme = "README.md"
|
|||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.11"
|
python = "^3.11"
|
||||||
aiohttp = {version = "^3.8.6", extras = ["speedups"]}
|
aiohttp = { version = "^3.8.6", extras = ["speedups"] }
|
||||||
sanic = {version = "^23.6.0", extras = ["ext"]}
|
sanic = { version = "^23.6.0", extras = ["ext"] }
|
||||||
ujson = "^5.8.0"
|
ujson = "^5.8.0"
|
||||||
asyncstdlib = "^3.10.9"
|
asyncstdlib = "^3.10.9"
|
||||||
pydantic = "^1.10.13"
|
pydantic = "^1.10.13"
|
||||||
@ -34,7 +34,7 @@ bson = "^0.5.10"
|
|||||||
fastpbkdf2 = "^0.2"
|
fastpbkdf2 = "^0.2"
|
||||||
cryptography = "^41.0.5"
|
cryptography = "^41.0.5"
|
||||||
sanic-limiter = { git = "https://github.com/Omegastick/sanic-limiter" }
|
sanic-limiter = { git = "https://github.com/Omegastick/sanic-limiter" }
|
||||||
sentry-sdk = {extras = ["sanic"], version = "^1.35.0"}
|
sentry-sdk = { extras = ["sanic"], version = "^1.35.0" }
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
asyncio_mode = "auto"
|
asyncio_mode = "auto"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user