Enable Mayan EDMS Sentry integration

How to enable Sentry integration in Mayan EDMS to capture error logs and monitor deployments.

Enable Mayan EDMS Sentry integration
Photo by Mick Haupt / Unsplash

If you're using Mayan EDMS in your organization, you may want to enable its integration with Sentry, a popular performance monitor and error tracking software. It helps identify and resolve errors while the deployment is running and can also help identify performance degradation before it becomes disruptive to your users.

The Sentry SDK is already included in the official Mayan EDMS Docker image so there is no need to install it, enabling it is that is required.

Configure Sentry

First create a project for Mayan EDMS in your Sentry installation.

Sentry project view.

Select the project and click on the gear icon.

Sentry project config view.

Copy the DSN value. This value will is going to allow communication between Mayan EDMS and the Sentry API.

Configure Mayan EDMS

Mayan EDMS has a system to include SDK and client software for third party systems. This system is called Platform Integrations. Enable the Sentry integration and pass it the project DSN to complete the process. The best way to do this is via environment variables.

Assign an environment name to your deployment to help identify it. This is a free form text entry. Good examples are "testing", "production", "region-x". "department-x". By using environments, the same DSN can be used and you will be able to determine which errors occur in an environment but not on others even when using the same Mayan EDMS version and build.

MAYAN_PLATFORM_CLIENT_BACKEND_ARGUMENTS='{"mayan.apps.platform.client_backends.ClientBackendSentry":{"dsn":"<Sentry DSN value here>","environment":"<Deployment environment>"}}'
Variables to enable Sentry and pass the DSN value.

Once the environment variables as configure, restart the Mayan EDMS deployment.

Mayan EDMS platform settings view.

Verify that the settings are detected correctly by Mayan EDMS.

Mayan EDMS Tools view.

A new tool button Called "Sentry test error" will be added to tools menu. This button will trigger a test error. The "Trigger tests" permission is required to be able to access the "Sentry test error" button.

Mayan EDMS error view.

The server error screen should be displayed after triggering the Sentry error.

Mayan EDMS error debug view.

The following screen will show if debug mode is enabled, such as when running Mayan EDMS in development mode.

Sentry project issues view.

Navigate to the Sentry Mayan EDMS project and click on "Issues". A new error entry with the name of "ZeroDivisionError" will show up.

Once you've verified that the integration is complete, enable more useful Sentry features like alerts.

Enabling Sentry integration in Mayan EDMS is a simple process that can greatly help you identify and resolve errors in your deployments with no delays, and ensure that your Mayan EDMS deployments run smoothly and efficiently.