Skip to content

Error tracking

Introduction

Every exception the program throws is reported to a platform automatically, identical errors are grouped, and you are told how many times it happened, who was affected, and on which line of code.

Why use it

  • Find issues proactively: you know about errors before users do.
  • Have the scene: full call stacks, request info, version, and environment are recorded—far more useful than “system error”.
  • Grouped: thousands of identical errors collapse into one item, ranked by impact so you know what to fix first.
  • Tied to releases: you can see “this error started with which version”.

How it differs from logs and monitoring

  • Logging records “what happened”—high volume, and you have to go looking.
  • Overall metrics and alerts tell you “is the whole system abnormal”, such as a rising error rate.
  • Error tracking tells you “which code, which exception, how many people were affected”, and notifies you proactively.

The three complement each other; none replaces the others.

Sentry and GlitchTip

  • Sentry: the most popular error-tracking platform; offers cloud hosting and self-hosting, with the richest feature set.
  • GlitchTip: a lighter open-source alternative that is compatible with the Sentry SDK, so your code still uses the Sentry SDK—you only change the reporting address (DSN) to GlitchTip’s. Consider it when resources are limited and you want to self-host.

A DSN is an address that tells the SDK which project to send errors to.

How to do it

  1. Create a project on the platform, get the DSN, and inject it via configuration—do not hardcode it.
  2. Initialize the SDK at app startup; it automatically captures unhandled exceptions.
  3. Label the environment (production/staging) and version (release) so you can tell sources apart.
  4. Attach useful context to events, such as a user ID (not email or phone number).
  5. Set alert rules: notify on new errors and error spikes.
  6. Exclude “handled expected errors” (such as bad user input) to keep the list clean. (Pair with Error handling.)

Component comparison

Sentry (SaaS or self-hosted)

Managed serviceFree tier + paidOpsLow

When a program errors, it automatically sends the error and its context to Sentry, which groups identical errors, counts occurrences, and notifies you.

Best forWeb applications and API services that want to know about production errors immediately and quickly pinpoint the cause.

Avoid whenYou have strict data-residency requirements and cannot self-host.

Pros

Errors are automatically grouped and deduplicated, showing the code location and call path of the failure

Mature SDKs for every language, integrated in a few lines of code

Can notify via email or chat tools and shows which release introduced the error

Cons

The SaaS edition requires a paid subscription beyond the free tier

The self-hosted edition has many components and is resource-hungry; a 2-core 2 GB machine cannot run it

The SaaS edition stores data on overseas servers, so access from China and compliance must be considered

Official docs ↗

GlitchTip

Self-hosted open sourceOpen sourceOpsMedium

A lightweight open-source error tracking tool that can use Sentry's SDKs directly but is cheaper on resources to deploy yourself.

Best forSmall teams that want to manage their own data and have limited server resources.

Avoid whenYou need all of Sentry's advanced features, or nobody is willing to maintain an extra service.

Pros

Compatible with the Sentry SDK, so application code does not change

Much lighter than deploying a full Sentry stack yourself

Error data stays on your own servers

Cons

Fewer features than Sentry, and advanced analysis is not available

A smaller community and fewer tutorials, so more problems are yours to solve

You still run the service, the database, and upgrades and backups

Official docs ↗

Cloud provider / Chinese error monitoring service

Cloud-managedPay-as-you-goOpsLow

Error reporting and alerting services from Chinese cloud providers or front-end monitoring vendors, with data stored in China.

Best forProjects dominated by mini program or front-end errors that have requirements on where data is stored.

Avoid whenThe backend is mainly C# or Python and error analysis requirements are high; Sentry is often a better fit then.

Pros

Access in China is fast, and error data can stay in the country

It can often work together with the cloud logs and alerts

The console and support are in Chinese, so there is someone to ask

Cons

C# and Python support is often weaker than Sentry

Billing is usually by reported volume or by subscription tier

Switching to another service means changing the integration code

Checklist

  • Production and test are both connected, with environment and version labeled
  • The DSN is injected via config, not hardcoded
  • Personal data is not sent by default; sensitive-field scrubbing is configured
  • Expected errors (bad user input) are not reported
  • New errors and error spikes notify a person
  • Someone owns regularly working through the error list