Christy Jacob

Logging with Sentry

Sentry is an open-source error-tracking and performance-monitoring tool designed to help developers identify, diagnose, and fix issues in real-time. It provides comprehensive insights into application health by capturing and analyzing error events, performance metrics, and user feedback. Sentry supports multiple programming languages and frameworks, making it versatile for various development environments. With features like stack traces, context data, and alerting, Sentry allows teams to quickly pinpoint the root cause of issues and improve the overall quality and reliability of their software applications.

How does the integration work?

If you are using self-hosting Appwrite, you can use the Sentry provider for error-tracking and logging for your Appwrite instance.

How to implement

To implement the Sentry provider for logging, there are several steps you must complete:

Step 1: Set up Sentry

First, sign up on Sentry and create a new project.

Create project

Head to Settings > Projects > Select your Sentry project > Client Keys (DSN). Save the DSN for further usage.

Step 2: Add Sentry provider to your Appwrite instance

For this step, you must self-host Appwrite if you haven’t already.

To add the Sentry provider, you need to slightly reconfigure your DSN. Your Sentry DSN is made up of 3 parts: public key, URI, and project ID. The Appwrite logging configuration expects a string in the format SENTRY_PUBLIC_KEY;SENTRY_PROJECT_ID. For example, if your Sentry DSN is https://public@sentry.example.com/1, then the Appwrite logging configuration will be public;1.

Visit the .env file created for your Appwrite instance and update the following environment variables:

Bash
_APP_LOGGING_PROVIDER=sentry
_APP_LOGGING_CONFIG=SENTRY_PUBLIC_KEY;SENTRY_PROJECT_ID

After that, run the following Docker Compose commands in your terminal to restart your Appwrite containers and verify if the changes have been successfully applied:

Bash
docker compose up -d --force-recreate
docker compose exec appwrite vars

Step 3: Test the provider

Once the Sentry provider is configured, run the following command in your terminal:

Bash
docker compose exec appwrite ssl --domain="wrongdomain.com"

Doing so will show errors in your Sentry Issues page.

Issues

You can also view the error details for more information.

Issue details

Read more about Sentry and Appwrite

If you would like to learn more about Sentry and Appwrite, we have some resources that you should visit:

Become a Technology Partner

Join our Technology Partners program to integrate your solutions with Appwrite’s API, enhancing functionality and expanding your reach.

Get Started