-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add sentry #2786
add sentry #2786
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This pull request introduces Sentry integration across various components of the Danswer application, enhancing error tracking and monitoring capabilities.
- Added Sentry initialization in
backend/danswer/main.py
andbackend/model_server/main.py
for the main API and model servers - Implemented Sentry integration in
backend/danswer/background/celery/celery_app.py
for Celery tasks - Introduced
SENTRY_DSN
environment variable inbackend/shared_configs/configs.py
anddeployment/docker_compose/docker-compose.dev.yml
- Reorganized configuration imports, moving several variables to
shared_configs/configs.py
for centralized management - Enhanced error handling and logging in various components, particularly in the tenant tracking middleware
13 file(s) reviewed, 8 comment(s)
Edit PR Review Bot Settings | Greptile
if SENTRY_DSN: | ||
sentry_sdk.init( | ||
dsn=SENTRY_DSN, | ||
integrations=[CeleryIntegration()], | ||
traces_sample_rate=1.0, | ||
) | ||
logger.info("Sentry initialized") | ||
else: | ||
logger.debug("Sentry DSN not provided, skipping Sentry initialization") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider moving Sentry initialization to a separate function for better modularity and testability
logger.info("Sentry initialized") | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Use logger.info for consistency with other log levels in the file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most users won't set Sentry so better to keep this quiet
backend/danswer/main.py
Outdated
integrations=[StarletteIntegration(), FastApiIntegration()], | ||
traces_sample_rate=1.0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: traces_sample_rate of 1.0 may be too high for production. Consider making this configurable
backend/model_server/main.py
Outdated
if SENTRY_DSN: | ||
sentry_sdk.init( | ||
dsn=SENTRY_DSN, | ||
integrations=[StarletteIntegration(), FastApiIntegration()], | ||
traces_sample_rate=1.0, | ||
) | ||
logger.info("Sentry initialized") | ||
else: | ||
logger.debug("Sentry DSN not provided, skipping Sentry initialization") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider moving Sentry initialization to a separate function for better modularity
backend/shared_configs/configs.py
Outdated
# Set up Sentry integration | ||
SENTRY_DSN = os.environ.get("SENTRY_DSN") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider adding a comment explaining the purpose of SENTRY_DSN and how it should be used
daad216
to
a73c089
Compare
a73c089
to
46c439e
Compare
46c439e
to
3dce229
Compare
b83e5b3
to
1e582f1
Compare
00b62c7
to
712d7e6
Compare
Description
Adds Sentry to background, model server, API server, and frontend.
Keeping mostly defaults so that we can evolve our approach as we determine what is/isn't useful