back arrow

Install Sentry APM on aws lightsail

25 - 12 - 2023

What is APM tool?

Application performance monitoring (APM) is the process of using software tools and telemetry data to monitor the performance of business-critical applications. Businesses want to ensure that they maintain expected service levels and that customers receive a positive application experience. - AWS

Why do we use APM?

NewRelic (our team’s first APM tool) has greatly assisted developers in identifying issues related to the speed of APIs and helps the team quickly respond to issues such as slowness, congestion, or system unavailability.

Based on the analysis of data flow in APM (NewRelic), developers can easily determine where the slowness occurs (which APIs? Which code sections?), and why it happens. A typical example is one incident that leads to SEPARATING THE ADMIN PART FROM THE APIs section, minimizing the negative impact of large SQL queries from the Admin part, which used to consume resources for Public APIs serving the app. Since then, there has been no more sudden spikes in computation for API queries.

Why change?

boss newrelic

How to install?

curl -O https://github.com/getsentry/self-hosted/archive/refs/tags/23.11.2.tar.gz
tar -xvzf 23.11.2.tar.gz
cd 23.11.2
./install.sh
sudo docker compose up -d

The result

Potential pitfalls

  1. If the number of transactions you track is too large, you might run out of burst capacity and the instance will not work any more. Priority your trace sampler https://docs.sentry.io/platforms/javascript/configuration/sampling/ lightsail metric

  2. Sentry might not be able to name your transaction properly when you use GraphQL. I run into this issue for Ruby https://github.com/rmosolgo/graphql-ruby/issues/3655. You’ll probably have to write your own custom tracer

  3. Don’t forget to pick an instance with 4 cores and 8GB. You’ll run into obscure error message with lesser instance