What is APM?
APM (application performance monitoring) measures what your application does with each request: throughput, error rate and latency per endpoint, plus where the time goes, such as database queries, cache calls and outbound HTTP requests. It works from inside the process, usually through an SDK or OpenTelemetry instrumentation that records traces.
Why APM matters
Uptime checks tell you the site answers; APM tells you why a page takes three seconds. When latency or errors rise after a deploy, APM shows which endpoint, which query and which external call changed.
It also finds problems no outside check can see: an N+1 query pattern, a slow third-party API, or one endpoint that fails for a small share of users while the homepage stays green.
APM metrics formulas: throughput, error rate, latency and Apdex
throughput = requests ÷ minutes error rate = failed requests ÷ total requests latency = percentiles (p50, p95, p99) per endpoint, not the average apdex = (satisfied + tolerating ÷ 2) ÷ total, with satisfied ≤ T and tolerating ≤ 4T
Worked example
An orders endpoint served 18,000 requests in a 15-minute window, 54 of which returned a 5xx status. Before the latest deploy its error rate was 0.05%.
- Throughput = 18,000 ÷ 15 = 1,200 requests per minute.
- Error rate = 54 ÷ 18,000 = 0.003, or 0.3%.
- Compared with 0.05% before the deploy, the error rate is now six times higher.
Result: A six-fold rise is a regression worth rolling back even though 99.7% of requests still succeed. APM's deploy markers and traces show which change caused it.
RED, USE and the four golden signals
| Method | Signals | Apply it to |
|---|---|---|
| RED (Tom Wilkie) | Rate, Errors, Duration | request-driven services: every endpoint, every consumer |
| USE (Brendan Gregg) | Utilisation, Saturation, Errors | resources: CPU, memory, disks, connection pools, worker pools |
| Four golden signals (Google SRE book) | Latency, Traffic, Errors, Saturation | a user-facing system as a whole |
APM gives you RED per endpoint out of the box. Saturation comes from the infrastructure side: a pool that is 100% busy is why latency jumps, and APM alone shows only the symptom.
APM compared with uptime checks, RUM and logs
| Tool | Runs | Answers | Blind spot |
|---|---|---|---|
| APM | inside your process | which endpoint, query or call is slow or failing | everything before your code: DNS, TLS, the network, the browser |
| Uptime and API checks | outside, on a schedule | is it up for the world, right now | why; partial failures between checks |
| RUM | in visitors' browsers | what real users experience | outages at night; the server-side cause |
| Logs | wherever you ship them from | the detail of one event | aggregates, unless you build them |
Worked example: why a slower endpoint exhausts workers
Little's law: requests in flight = throughput × latency. The orders endpoint from the example serves 1,200 requests a minute, which is 20 a second. At a 250 ms median, 20 × 0.25 = 5 requests are in flight on average.
A deploy adds a slow query and the median becomes 900 ms: 20 × 0.9 = 18 requests in flight. With a pool of 16 workers, requests now queue, the queue adds more latency, and errors follow. APM shows the slow query; the arithmetic shows why a modest slowdown turned into an outage.
Sampling: how many traces you keep
At 1,200 requests a minute an endpoint serves 1,200 × 1,440 = 1,728,000 requests a day. Random head sampling at 10% keeps 172,800 traces. An error that hits 0.05% of requests happens 864 times a day, and random sampling keeps about 86 of them: enough to debug, but a rarer error at 0.001% (about 17 a day) leaves one or two.
Tail-based or error-biased sampling decides after the request finished, so it can keep every error and every slow trace while dropping the fast, boring ones. Vigil stores the worst traces per endpoint per window, errors first and then the slowest.
What to instrument first
- Incoming requests on every web process: endpoint, status and duration give you RED per endpoint on day one.
- Database calls, with the normalised query text, so slow and repeated queries are visible.
- Outbound HTTP calls to payment, email and other third-party APIs, which fail and slow down on their own schedule.
- Background workers (Celery, Sidekiq, queue consumers), which share the database and are often where slowness starts.
- Deploy markers, so every change in a chart can be tied to a release.
Worked example: reading where 820 ms went
A slow trace of GET /orders takes 820 ms: 540 ms in 41 database queries, 180 ms in one call to a shipping API, and 100 ms in your own code. The database share is 540 ÷ 820 = 65.9%, and 41 near-identical queries is the signature of an N+1 query. Fixing that typically brings the database time down to a few queries; caching the shipping call removes most of the rest. See the Django, FastAPI and Node.js guides for instrumentation.
Common mistakes
- Watching averages. A mean latency hides the slow tail. Use percentiles per endpoint.
- Sampling away the evidence. Aggressive random sampling can drop exactly the slow or failed traces you need. Keep the worst traces even if you sample the rest.
- No deploy markers. Without knowing when releases happened, a regression is hard to tie to a change.
- Instrumenting only the web tier. Background workers and queue consumers have performance problems too, and they often hold the same database.
- Ignoring saturation. Latency jumps only once a worker or connection pool is full. Watch pool utilisation next to endpoint latency, or you only ever see the symptom.
- Alerting on a one-minute p99. At low traffic a minute’s p99 is a single request, so the alert flaps. Use longer windows or error-budget burn instead.
How Vigil handles APM
- Vigil's APM takes traces from its Python (ASGI/WSGI) and Node SDKs or from any OpenTelemetry SDK at
https://puzaricloud.in/otlp/v1/traces. - You get endpoints with latency histograms, stored slow traces with a span timeline, slow queries ranked by total time, slow outbound calls, N+1 detection, Apdex with your own T, and deploy impact.
- Errors from any Sentry SDK land in the same workspace, and Time Detective lines up traces, errors, logs and deploys around one moment.
APM (application performance monitoring): frequently asked questions
What is the difference between APM and observability?
APM is one part of observability: the application's own performance data, mostly traces. Observability also covers logs, infrastructure metrics and real user data, and the ability to ask new questions of all of them.
Does APM slow my application down?
Instrumentation adds some work per request, usually small next to the database and network calls it measures. Batching and sampling keep it low; measure it in your own load test.
Do I need APM if I already have uptime monitoring?
Uptime monitoring tells you from the outside that something is wrong. APM tells you where in the code the time or the errors come from. Most teams use both.