What does Sentry do?
When an exception occurs in a monitored application, a call back to Sentry activates a workflow. The portion of code that is defective is identified by Sentry, and a ticket is opened for the development team.
When integrating Sentry into the application life cycle, you will have a variety of choices to implement your applications' APIs (frontend or backend).
The best deployment scenarios where Sentry shines are frontend deployments where the application sits in the cloud on a Kubernetes cluster or a cloud instance (AWS, Google Cloud Platform, or Azure).
Sentry records users' interactions with your applications. If an application is in the cloud, the monitoring data only flows from the application server to the Sentry server. In this scenario, the clients access the application using a web server or other SaaS delivery method.
Sentry data flow
In Sentry, everything starts with an exception. If the application interaction with the user creates an exception, an encrypted message is sent by the application server to the Nginx web server, where a relay queues the event for ingestion by Kafka.
Implementing self-hosted Sentry
Sentry can be implemented in two ways: a SaaS offering hosted by sentry.io, and a self-hosted open source version. The most efficient and economical way to deploy the self-hosted version is to run a virtual machine in the cloud.
The instance should be capable of running the various containers needed. Thus, you need at least a 4 CPU 8 GB RAM instance type (m6ixlarge in AWS or B4ms in Azure). I/O might become an issue when you start ingesting data, so you have to keep an eye on the communication between your Sentry instance and your application servers.
Self-hosted Sentry requires minimal customization. You need to install Docker and Docker Compose on the instance of choice. After cloning the repository from GitHub, execute this command:
The script will take care of standing up the application. The README file included in the repository will provide more information for customization.
Sentry can geolocate the request received by the application if the geolocation file is included in the application's initial configuration. Detailed instructions are available.
Finally, you may want to integrate the application with a mail relay server, so it can send emails to users, allowing them to register and access the web portal. Detailed instructions are available here.
Note that inbound mail is provided by Mailgun and is not enabled by default. Outgoing mail is the functionality most frequently used when interacting with the application.
Once you have completed the basic configuration, the next step is to run this command:
docker compose up -d
The application is available on port 9000 by default using clear TCP. A good practice would be to use a network load balancer, so port 9000 is exposed as TLS and protected. A description of the process is described on the Vendor page under "Productionalizing."
Sentry is integrated with applications on the Sentry Web Portal. Sentry supports almost all programming languages, and detailed instructions on how to instrument the code with Sentry are provided.
Self-hosted vs. SaaS
As mentioned above, Sentry offers a cloud-based SaaS solution in addition to the self-hosted version. Both solutions offer the same functionality. However, many customers find that a self-hosted Sentry can quickly become expensive to maintain and scale, often making the SaaS product the better and less costly option. More details about the differences between the self-hosted and SaaS versions can be found in this PDF flyer.
If you want to start with self-hosted Sentry, you can migrate later to the SaaS version, as described in the migration guide.
Subscribe to 4sysops newsletter!
To get started with Sentry, check out the online demo.