Skip to content

VitalRix guide

What is APM (application performance monitoring)?

APM shows how fast your application answers, where the time goes inside each request and which requests fail. This guide covers how it works, the metrics worth watching and a worked example you can copy.

15 min read17 sectionsUpdated

On this page

Key takeaways

  • APM looks from the inside. It records what your code does for each request: the route, the database queries, the calls to other services and how long each took.
  • Use percentiles, not averages. p95 and p99 show what your slowest users feel; an average hides them.
  • Three numbers cover most problems: request rate, error rate and duration (the RED method).
  • A trace is the unit of debugging. Every chart should lead to the individual requests behind it.
  • Start with one service. Instrument it, watch its endpoints for a week, then add alerts and spread out.

APM in plain words

Imagine a customer writes in: "checkout was really slow yesterday afternoon." An uptime check would have said the site was up. Your logs say 200 OK, hundreds of thousands of times. Nothing in either tells you which request was slow, or why.

Application performance monitoring (APM) records what your application does while it serves each request, then summarizes it. You can see that POST /checkout got slower at 15:10, that the slowness came from one SQL query, and that the query started running 38 times per request after a release at 15:05. Instead of guessing, you follow the evidence from a chart to a request to a line of code.

APM is the "inside view" of your software. It sits alongside two outside views: uptime monitoring, which asks whether the service answers, and real user monitoring, which measures what visitors experience in their browsers.

What APM measures

  • Throughput

    How many requests your service handles per second or minute, per route. Throughput tells you what normal looks like and exposes the two quiet failures: traffic that suddenly vanishes, and traffic that doubles after a campaign or a retry storm.

  • Latency

    How long requests take, summarized as percentiles. p50 is the typical request, p95 is the time 95 of every 100 requests finish within, p99 is the worst 1 in 100. Slow tails are where unhappy users live.

  • Error rate

    The share of requests that fail: failed requests divided by all requests. In VitalRix a failed request has an error status or an HTTP 5xx answer. A 4xx is the client being wrong and is counted separately.

  • Dependencies

    Time spent waiting on databases, caches and other services. Most slow endpoints are slow because of one dependency, so this breakdown is often the whole diagnosis.

  • Deployments

    A marker for each release so you can compare latency and errors before and after. Most regressions arrive with a deploy, so this is usually the first thing to check.

  • Resources

    CPU, memory, event-loop delay or JVM heap for the processes running your code. They explain slowness that has nothing to do with a particular query, such as a service running out of memory.

How it works under the hood

Traces and spans

A trace is the full story of one request. It is made of spans: each span is one unit of work with a start time, a duration, a name and attributes. An incoming HTTP request is a span. Inside it, a call to the pricing service is a child span, and inside that, a SQL query is another. Drawn on a timeline, a trace looks like a waterfall, and the longest bar is usually your answer.

How spans from different services join up

When service A calls service B, it passes the trace ID and its own span ID along in an HTTP header. The standard is the W3C traceparent header, which looks like 00-<32 hex trace id>-<16 hex span id>-01. Service B reads it and creates its spans as children of A's span. Because both report the same trace ID, a backend can stitch them into one tree. This is context propagation, and it is the reason distributed tracing works across languages and teams.

Instrumentation

Spans are created by instrumentation. Automatic instrumentation wraps popular HTTP frameworks, database drivers and HTTP clients, so you get useful spans without editing business code. Manual instrumentation adds spans around your own logic, such as "price calculation" or "send invoice". Most teams start automatic and add a handful of manual spans where it matters.

Export, ingest and aggregate

The SDK collects finished spans in memory and ships them in batches, in the background, to a backend. The backend does two jobs. It stores traces so you can open one request. It also aggregates spans into metrics: requests, failures and latency histograms per service and route, which is what makes the overview charts fast. A good APM merges histograms rather than averaging averages, so a p95 over a day is a real p95 and not a blend of hourly numbers.

Sampling

On very busy services, recording every trace costs money. Sampling keeps a share of traces. The rule that matters is "parent-based": if the first service decides to keep a trace, every downstream service keeps its part too, so you never see half a request. One consequence to know: counts reflect what you send. At 10% sampling, a dashboard shows 10% of the true traffic, so request counts are not billing-grade totals.

What it looks like in practice

These are real VitalRix screens, from the overview down to a single request. Notice the order: summary first, then the slowest routes, then one trace. That drill-down is the whole job.

Overview: requests, error rate, p95 and average latency, and the latency percentiles over time.
Endpoints: normalized routes with p50, p95 and p99, so one slow route cannot hide inside a service average.
A trace waterfall: the gateway span at the top, the backend span below it and the database spans that account for the time.

Metrics that matter, and what "good" looks like

There is no universal "good" latency. What matters is that a route is fast enough for what it does, and that it does not drift. These ranges are common starting points, not rules.

MetricWhat it tells youA reasonable starting targetAlert when
p50 latencyThe typical requestUnder 100 ms for API readsIt doubles against its own baseline
p95 latencyWhat your slower users feelUnder 300 ms for API reads, under 1 s for heavy pagesIt stays 50% above normal for 5 to 10 minutes
p99 latencyWorst-case behaviour, retries and timeoutsUnder 3x your p95It approaches a client or gateway timeout
Error rateShare of failed requestsUnder 0.1% on stable servicesAbove 1%, or 2 points above the usual rate
Request rateTraffic volume and shapeStable within a daily patternIt drops to near zero, or jumps well above peak
Database time per requestHow much of each request is spent on queriesA minority of total request timeDatabase p95 climbs while traffic is flat

Two ideas keep these numbers honest.

Compare an endpoint with itself. A report export that takes 2 seconds is fine; a login that takes 2 seconds is not. VitalRix flags an endpoint as degraded when its p95 is at least 1.5 times, and at least 50 ms, above its own 7-day baseline. That test catches real drift without a hand-tuned threshold per route.

Normalize routes. GET /orders/84213 and GET /orders/90177 are the same endpoint. Good APM replaces IDs, UUIDs, tokens and dates with a placeholder, so you get one row for GET /orders/:id and a p95 that means something.

RED, USE and the golden signals

Comparison
FeatureBest forMeasures
REDRequest-driven services, such as APIs and web backendsRate, Errors, Duration
USEResources, such as CPU, disks and connection poolsUtilization, Saturation, Errors
Four golden signalsA general starting point for any serviceLatency, traffic, errors, saturation

They agree more than they differ. Use RED for every service and USE for the machines and pools underneath them. If a service looks slow and its RED numbers are fine, check saturation: a full connection pool or an exhausted CPU limit makes healthy code wait.

A worked example: the slow checkout

Numbers here are illustrative, but the pattern is one of the most common in real systems.

The symptom. Support reports slow checkouts. The APM overview for the shop-api service shows 4,800 requests in the last hour, an error rate of 0.25% (12 failures) and a p95 of 1.8 seconds, up from about 450 ms yesterday.

Narrow down. On the Endpoints page, filtered to degraded routes, only one stands out: POST /checkout has a p50 of 210 ms but a p95 of 2.4 s. Every other route is within its baseline. So this is one endpoint, not the whole service.

Check the deploy. The deployment marker shows version 2026.10.19-3 went live at 15:05. The p95 rose at 15:10. The change came after the release, which is a strong lead but not proof.

Open a slow trace. The waterfall for a 2.6-second POST /checkout shows the handler at 2,600 ms. Inside it are 38 separate SELECT spans against order_items, each about 35 ms, back to back. That is 38 x 35 ms = 1.33 seconds of queries in a row, plus pricing and payment calls. This is the classic N+1 query: one query to fetch the cart, then one more per item.

Fix and verify. The team replaces the loop with one query using WHERE id IN (...). After the next deploy, the same trace shows 1 query of about 45 ms. The p95 for POST /checkout falls from 2.4 s to about 400 ms and the Database view shows call volume dropping by roughly 30x for that statement.

What made it fast to solve: percentiles showed the problem average latency would have hidden, the endpoint list isolated the route, the deploy marker pointed at the time, and the trace showed the exact repeated query. Four clicks, no guessing.

Common pitfalls

APM and its neighbours

TopicAnswersMeasured fromRead
Uptime monitoringIs it reachable and correct right now?Outside, on a schedule[What is uptime monitoring](/guides/what-is-uptime-monitoring)
Synthetic monitoringDoes a scripted journey still work?Outside, scripted[What is synthetic monitoring](/guides/what-is-synthetic-monitoring)
Real user monitoringHow does it feel for real visitors?Visitors’ browsers[What is real user monitoring](/guides/what-is-real-user-monitoring)
OpenTelemetryHow do I produce the data in a vendor-neutral way?Inside your code[What is OpenTelemetry](/guides/what-is-opentelemetry)
Logs and metricsWhat exactly did the code say, and how did a number move?Inside your code[Logs, metrics and traces](/product/logs-metrics-traces)

A useful mental model: uptime tells you that something is wrong, APM tells you where and why, and RUM tells you who it affected. Link them and an alert becomes a diagnosis: the failing check, the failing route and the trace behind it.

Getting started with VitalRix APM

  1. Pick one important service. The one customers notice first: the main API or the web backend. Resist instrumenting everything on day one.
  2. Create an API key. In Settings, add a key that can write traces and keep it in a server-side environment variable. Never put it in browser code.
  3. Instrument with OpenTelemetry. Install the SDK and HTTP and database instrumentation for your language, then point the OTLP exporter at VitalRix. The OpenTelemetry page in the Monitor app has copy-paste setup with your endpoint filled in.
  4. Name things well. Set service.name to the application slug, deployment.environment.name to production or staging, and service.version to a release tag or commit so deployments show up.
  5. Send a test span, then deploy. The setup guide includes a one-line curl that sends a test span. Once you see the service in APM, deploy the instrumented build.
  6. Read the overview after a day. Sort Endpoints by p95 and by error rate. Open the slowest trace and look at the database spans.
  7. Add two alerts. Create an APM alert rule on p95 latency and one on error rate for the service, with a time window so a short spike does not page anyone. Route them to Slack, email or your on-call policy.
  8. Add the neighbours. Add an uptime monitor for the public URL and real user monitoring for the browser side.

Details live in the APM docs and the APM setup guide. For product capabilities, see VitalRix APM.

Glossary

  • Span: one timed unit of work inside a request, such as a handler, a query or an outgoing call.
  • Trace: all the spans that belong to one request, across services.
  • Context propagation: passing the trace ID between services, usually in the W3C traceparent header.
  • Percentile (p50, p95, p99): the value that a given share of requests stay under. p95 = 95% are faster.
  • Throughput: requests per unit of time.
  • Error rate: failed requests divided by total requests.
  • Endpoint: a method plus a normalized route, such as GET /orders/:id.
  • Instrumentation: code that creates spans, automatic or manual.
  • Sampling: keeping only a share of traces to control cost.
  • Service map: a graph of which services call which, drawn from observed traces.
  • N+1 query: a loop that runs one query per item instead of one query for all of them.
  • Baseline: the usual value for a metric, such as an endpoint's own last 7 days.

When you do not need APM yet

APM earns its keep once a request touches more than one moving part. You can reasonably wait if:

  • You run a static site or a mostly content-driven page. Uptime checks and real user monitoring tell you almost everything.
  • You have a single small service with a handful of users and logs you can read in a minute.
  • Nothing is slow or failing and nobody is asking why.

Even then, adding it early is cheap: the baseline you collect while things are calm is what makes the first bad day easy to read.

When APM is not enough

  • The problem lives in the browser. A slow page caused by heavy images or JavaScript is invisible to server-side APM. Use real user monitoring.
  • You need to know it is down. If the process is dead, it sends no spans. An outside uptime check is what notices silence.
  • You need business context. APM tells you a route is slow, not that a particular customer is affected. Add attributes you can search on, and use logs.

Frequently asked questions

What is APM in simple terms?

APM is software that watches your application from the inside and records, for every request, how long it took, which steps it went through and whether it failed. You use it to find out why something is slow or broken, not just that it is.

What is a good p95 latency?

It depends on the endpoint. Many teams aim for under 300 ms for API reads and under 1 second for heavier pages, then alert when p95 rises well above its own usual level. A route that is steady at 800 ms is often less worrying than one that jumped from 200 ms to 400 ms.

Why p95 and not the average?

Averages hide the slow tail. If 95 requests take 100 ms and 5 take 10 seconds, the average is about 600 ms, which describes nobody. p95 and p99 describe the experience of the slowest users, who are the ones who complain.

What is the difference between APM and logging?

Logs record what your code chose to say. APM records the structure and timing of each request automatically. They work best together: a trace shows which request was slow, and the logs sent with the same trace ID say what the code was doing.

What is the difference between APM and observability?

APM is one part of observability. Observability is the wider ability to ask new questions of a running system using traces, metrics, logs and real-user data, ideally linked to each other.

Does APM slow my application down?

Very little when done well. Spans are created in memory and exported in the background in batches with a bounded queue, so requests do not wait on the exporter. On very busy services you can sample a share of requests to cut the cost further.

Do I need a vendor agent?

Not any more. OpenTelemetry is the open standard for producing traces, so your code depends on a neutral SDK and the destination is configuration. VitalRix APM is built from standard OpenTelemetry traces with no proprietary agent.

How is a failed request defined?

In VitalRix, a request with an error status or an HTTP 5xx answer. HTTP 4xx answers are client errors and are counted separately, so a wave of bad requests from a client does not look like an outage.

How do I connect APM to alerts?

Create an alert rule on an APM metric such as p95 latency, error rate, request count or heartbeat age, and narrow it to a service, an environment or even a single endpoint. Add a time window so only a sustained problem fires.

Can APM find the exact line of code?

It finds the request, the span and the query or call responsible, and for exceptions it shows the stack trace. That is usually enough to find the line quickly, but APM is not a debugger and does not show variable values.

How many services should I instrument first?

One. Pick the service customers feel most, get its endpoints and database calls into APM, set two alerts, and expand. A second service is when the service map starts to pay off.

How do I know a regression came from a deploy?

Send a version with your traces. VitalRix shows each new version as a deployment with latency and errors around it, and flags a possible regression when p95 rises by 25% and at least 25 ms, or the error rate by 2 points. It shows that the change came after the deployment; it does not claim the deployment caused it, so confirm in a trace.

Check it now, free

  • OpenTelemetry for Flask: Instrument a Flask app with OpenTelemetry, in code or with zero code: trace routes, SQLAlchemy and outgoing calls, and export to VitalRix.
  • PHP performance monitoring: Monitor PHP and Laravel apps: request latency, PHP-FPM worker saturation, OPcache hit rate, slow queries, external calls and errors.
  • Python performance monitoring: Monitor Python web apps: request latency per route, worker saturation, the GIL and CPU-bound code, database time, Celery queues and memory.
  • The RED method: The RED method explained: rate, errors and duration for every service, how to compute each from traces, a dashboard layout and the alerts worth setting.
  • OpenTelemetry for Django: Trace a Django app with OpenTelemetry: auto-instrument views and the ORM, run under gunicorn safely, trace Celery tasks and export to VitalRix.
  • Java performance monitoring: Monitor Java and Spring applications: JVM heap and GC, thread pools, JDBC connection pools, request latency from traces.

See where your requests spend their time

Send traces from one service and the overview, endpoints and slowest queries fill in within minutes. Free to start, no credit card needed.