Observability

Sentry

An error and performance tracking platform: it collects exceptions with stack traces, releases and context.

What it is

Sentry started in 2008 as an open source Django project for error tracking. Today it is a platform from Sentry Inc with SDKs for most languages and frameworks (JavaScript, Python, Go, Java, mobile).

It groups identical errors and shows the stack trace, browser or device, release version and breadcrumbs of user actions before the crash. There is performance monitoring (traces), Session Replay and profiling.

The code is available under the Functional Source License (FSL), which later converts to Apache-2.0 or MIT, so you can self-host Sentry, but it is not a classic open source license.

Use it when

  • You want to learn about production errors fast with full context.
  • Frontend and mobile apps where errors happen on user devices.
  • You want to link errors to releases and commits.
  • You need alerts about new or frequent errors in Slack.

Avoid it when

  • You need general infrastructure metrics: Prometheus and Grafana are better.
  • You need an OSI license for unrestricted self-hosting rather than FSL.
  • Strict limits on sending data to third parties without the ability to run your own instance.

Key concepts

Issue
A grouped set of identical error events by fingerprint.
Release
A code version: it shows which release introduced an error and lets you mark it resolved.
Source maps
Uploaded for minified JavaScript so the stack trace shows original code.
Breadcrumbs
A timeline of events before the error: clicks, requests, logs.
Performance / Tracing
Traces and transactions that show slow requests and dependencies.

Example

Initializing Sentry in Node.js and capturing an error manually.

Interview questions

  1. 1. Why Sentry if you have logs?

    Sentry groups identical errors, counts how many users were hit and adds the stack trace, release and context. From logs you would assemble that by hand, while Sentry reports new failures itself.

  2. 2. Why upload source maps?

    Production JavaScript is minified, and a stack trace without maps shows unreadable names. Source maps let you see the original file and line of code.

  3. 3. What is sampling in Sentry?

    The tracesSampleRate option sets the share of transactions collected for performance monitoring. It cuts data volume and cost, while errors are usually all collected.

Interview questions from the bank

Logos belong to their owners and are used for identification only. Icons: Simple Icons (CC0), Devicon (MIT).