Skip to content
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

Merged
merged 5 commits into from
Oct 17, 2024
Merged

add sentry #2786

merged 5 commits into from
Oct 17, 2024

Conversation

pablonyx
Copy link
Contributor

@pablonyx pablonyx commented Oct 13, 2024

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

Copy link

vercel bot commented Oct 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
internal-search ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 17, 2024 10:04pm

@pablonyx pablonyx marked this pull request as ready for review October 13, 2024 23:25
Copy link

@greptile-apps greptile-apps bot left a 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 and backend/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 in backend/shared_configs/configs.py and deployment/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

Comment on lines 48 to 56
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")
Copy link

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

Comment on lines +54 to +55
logger.info("Sentry initialized")
else:
Copy link

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

Copy link
Contributor Author

@pablonyx pablonyx Oct 15, 2024

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

Comment on lines 214 to 215
integrations=[StarletteIntegration(), FastApiIntegration()],
traces_sample_rate=1.0,
Copy link

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

Comment on lines 88 to 96
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")
Copy link

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

Comment on lines 70 to 75
# Set up Sentry integration
SENTRY_DSN = os.environ.get("SENTRY_DSN")
Copy link

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

@rkuo-danswer rkuo-danswer added this pull request to the merge queue Oct 17, 2024
Merged via the queue into main with commit 61424de Oct 17, 2024
7 checks passed
@rkuo-danswer rkuo-danswer deleted the sentry_on_main branch October 18, 2024 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants