Spaces:
Runtime error
Runtime error
Greg Thompson
commited on
Commit
·
730dead
1
Parent(s):
806adc5
Add Sentry to FastAPI app
Browse files- app.py +15 -0
- requirements.txt +1 -0
app.py
CHANGED
|
@@ -6,6 +6,7 @@ import scripts.quiz.generators as generators
|
|
| 6 |
import scripts.quiz.hints as hints
|
| 7 |
import scripts.quiz.questions as questions
|
| 8 |
import scripts.quiz.utils as utils
|
|
|
|
| 9 |
|
| 10 |
from fastapi import FastAPI, Request
|
| 11 |
from fastapi.responses import JSONResponse
|
|
@@ -20,6 +21,15 @@ from mathtext_fastapi.conversation_manager import manage_conversation_response
|
|
| 20 |
from mathtext_fastapi.nlu import evaluate_message_with_nlu
|
| 21 |
from mathtext_fastapi.nlu import run_intent_classification
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
app = FastAPI()
|
| 24 |
|
| 25 |
app.mount("/static", StaticFiles(directory="static"), name="static")
|
|
@@ -36,6 +46,11 @@ def home(request: Request):
|
|
| 36 |
return templates.TemplateResponse("home.html", {"request": request})
|
| 37 |
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
@app.post("/hello")
|
| 40 |
def hello(content: Text = None):
|
| 41 |
content = {"message": f"Hello {content.content}!"}
|
|
|
|
| 6 |
import scripts.quiz.hints as hints
|
| 7 |
import scripts.quiz.questions as questions
|
| 8 |
import scripts.quiz.utils as utils
|
| 9 |
+
import sentry_sdk
|
| 10 |
|
| 11 |
from fastapi import FastAPI, Request
|
| 12 |
from fastapi.responses import JSONResponse
|
|
|
|
| 21 |
from mathtext_fastapi.nlu import evaluate_message_with_nlu
|
| 22 |
from mathtext_fastapi.nlu import run_intent_classification
|
| 23 |
|
| 24 |
+
sentry_sdk.init(
|
| 25 |
+
dsn="https://[email protected]/4504896688881664",
|
| 26 |
+
|
| 27 |
+
# Set traces_sample_rate to 1.0 to capture 100%
|
| 28 |
+
# of transactions for performance monitoring.
|
| 29 |
+
# We recommend adjusting this value in production,
|
| 30 |
+
traces_sample_rate=1.0,
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
app = FastAPI()
|
| 34 |
|
| 35 |
app.mount("/static", StaticFiles(directory="static"), name="static")
|
|
|
|
| 46 |
return templates.TemplateResponse("home.html", {"request": request})
|
| 47 |
|
| 48 |
|
| 49 |
+
@app.get("/sentry-debug")
|
| 50 |
+
async def trigger_error():
|
| 51 |
+
division_by_zero = 1 / 0
|
| 52 |
+
|
| 53 |
+
|
| 54 |
@app.post("/hello")
|
| 55 |
def hello(content: Text = None):
|
| 56 |
content = {"message": f"Hello {content.content}!"}
|
requirements.txt
CHANGED
|
@@ -9,6 +9,7 @@ python-Levenshtein
|
|
| 9 |
requests==2.27.*
|
| 10 |
sentencepiece==0.1.*
|
| 11 |
sentence-transformers
|
|
|
|
| 12 |
supabase
|
| 13 |
transitions
|
| 14 |
uvicorn==0.17.*
|
|
|
|
| 9 |
requests==2.27.*
|
| 10 |
sentencepiece==0.1.*
|
| 11 |
sentence-transformers
|
| 12 |
+
sentry-sdk[fastapi]
|
| 13 |
supabase
|
| 14 |
transitions
|
| 15 |
uvicorn==0.17.*
|