fix: 🐛 sentry (#1716)

reduce sampling

# Description

Please include a summary of the changes and the related issue. Please
also include relevant motivation and context.

## Checklist before requesting a review

Please delete options that are not relevant.

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented hard-to-understand areas
- [ ] I have ideally added tests that prove my fix is effective or that
my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged

## Screenshots (if appropriate):
This commit is contained in:
Stan Girard 2023-11-27 10:08:00 +01:00 committed by GitHub
parent c296ee5dd2
commit 56a5c81fe4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 32 deletions

View File

@ -20,14 +20,6 @@ from routes.misc_routes import misc_router
logger = get_logger(__name__) logger = get_logger(__name__)
sentry_dsn = os.getenv("SENTRY_DSN")
if sentry_dsn:
sentry_sdk.init(
dsn=sentry_dsn,
traces_sample_rate=0.1,
profiles_sample_rate=0.1,
)
app = FastAPI() app = FastAPI()
add_cors_middleware(app) add_cors_middleware(app)

View File

@ -1,4 +1,3 @@
import os
from packages.utils import handle_request_validation_error from packages.utils import handle_request_validation_error
@ -8,7 +7,6 @@ if __name__ == "__main__":
from dotenv import load_dotenv # type: ignore from dotenv import load_dotenv # type: ignore
load_dotenv() load_dotenv()
import sentry_sdk
from fastapi import FastAPI, HTTPException from fastapi import FastAPI, HTTPException
from fastapi.responses import JSONResponse from fastapi.responses import JSONResponse
from logger import get_logger from logger import get_logger
@ -17,15 +15,6 @@ from routes.crawl_routes import crawl_router
from routes.misc_routes import misc_router from routes.misc_routes import misc_router
logger = get_logger(__name__) logger = get_logger(__name__)
sentry_dsn = os.getenv("SENTRY_DSN")
if sentry_dsn:
sentry_sdk.init(
dsn=sentry_dsn,
traces_sample_rate=0.1,
profiles_sample_rate=0.1,
)
app = FastAPI() app = FastAPI()
add_cors_middleware(app) add_cors_middleware(app)

View File

@ -27,6 +27,8 @@ from routes.misc_routes import misc_router
from routes.notification_routes import notification_router from routes.notification_routes import notification_router
from routes.subscription_routes import subscription_router from routes.subscription_routes import subscription_router
from routes.upload_routes import upload_router from routes.upload_routes import upload_router
from sentry_sdk.integrations.starlette import StarletteIntegration
from sentry_sdk.integrations.fastapi import FastApiIntegration
logger = get_logger(__name__) logger = get_logger(__name__)
@ -43,6 +45,16 @@ if sentry_dsn:
dsn=sentry_dsn, dsn=sentry_dsn,
traces_sample_rate=0.1, traces_sample_rate=0.1,
profiles_sample_rate=0.1, profiles_sample_rate=0.1,
sample_rate=0.1,
enable_tracing=True,
integrations=[
StarletteIntegration(
transaction_style="endpoint"
),
FastApiIntegration(
transaction_style="endpoint"
),
]
) )
app = FastAPI() app = FastAPI()

View File

@ -13,13 +13,13 @@ fastapi==0.95.2
python-multipart==0.0.6 python-multipart==0.0.6
uvicorn==0.22.0 uvicorn==0.22.0
pypandoc==1.11 pypandoc==1.11
docx2txt==0.8 docx2txt==0.8
python-jose==3.3.0 python-jose==3.3.0
asyncpg==0.27.0 asyncpg==0.27.0
flake8==6.0.0 flake8==6.0.0
flake8-black==0.3.6 flake8-black==0.3.6
sentry-sdk==1.26.0 sentry-sdk==1.37.1
sentry-sdk[fastapi]==1.37.1
pyright==1.1.316 pyright==1.1.316
resend==0.5.1 resend==0.5.1
html5lib==1.1 html5lib==1.1

View File

@ -18,15 +18,6 @@ from routes.misc_routes import misc_router
from routes.upload_routes import upload_router from routes.upload_routes import upload_router
logger = get_logger(__name__) logger = get_logger(__name__)
sentry_dsn = os.getenv("SENTRY_DSN")
if sentry_dsn:
sentry_sdk.init(
dsn=sentry_dsn,
traces_sample_rate=0.1,
profiles_sample_rate=0.1,
)
app = FastAPI() app = FastAPI()