How to Set Up APM (Application Performance Monitoring)

Application Performance Monitoring goes beyond basic server metrics, tracking actual application-level performance — request timing, error rates, and code-level bottlenecks. This guide covers self-hosted APM options.

What APM Adds Beyond Basic Server Monitoring

Server metrics (CPU, RAM, disk) tell you about infrastructure health; APM tracks application-specific behavior — individual request traces, database query timing within a request, error rates by endpoint, and code-level performance detail that infrastructure metrics alone don't reveal.

Self-Hosted APM Options

Several open-source APM tools exist that you can self-host, avoiding the recurring cost and data-sharing considerations of commercial SaaS APM platforms — commonly built on similar foundations to the observability stack covered in earlier categories (metrics, traces, logs unified).

Building APM from Observability Components

See How to Instrument an Application with OpenTelemetry and How to Implement Distributed Tracing with Jaeger — combining application instrumentation, distributed tracing, and metrics collection effectively constitutes a self-built APM solution, using standard open-source components rather than a single monolithic APM product.

Key APM Metrics to Track

  • Request rate and response time (overall and per-endpoint)
  • Error rate by endpoint/operation
  • Database query time as a proportion of total request time
  • Apdex score (a standardized user-satisfaction performance metric)

Setting Up Endpoint-Level Timing

const requestDuration = meter.createHistogram('http_request_duration_seconds');

app.use((req, res, next) => {
  const start = Date.now();
  res.on('finish', () => {
    const duration = (Date.now() - start) / 1000;
    requestDuration.record(duration, { route: req.route?.path, method: req.method, status: res.statusCode });
  });
  next();
});

Basic middleware-level instrumentation tracking per-request timing, feeding into your metrics system (see How to Set Up Prometheus and Grafana for VPS Monitoring) for dashboard visualization.

Building an APM Dashboard

See How to Build a Monitoring Dashboard for Your Whole Team — construct dashboards specifically showing application-level metrics (per-endpoint latency, error rates) alongside your infrastructure metrics for a complete performance picture.

Setting Up Alerting on APM Metrics

See How to Set Up Effective Server Alerting (Without Alert Fatigue) — alert on application-level degradation (elevated error rate, response time exceeding SLO thresholds), not just infrastructure-level resource exhaustion.

Correlating APM with Distributed Tracing

See How to Correlate Logs, Metrics, and Traces During an Incident — APM metrics tell you that something's slow; distributed tracing tells you where specifically in a complex request chain the slowness originates.

When Commercial SaaS APM Might Still Make Sense

Self-hosted APM requires more setup and ongoing maintenance than a managed SaaS solution — if your team's time is better spent elsewhere and budget allows, a commercial APM product remains a legitimate choice; the self-hosted approach trades operational effort for cost savings and data control.

Common Errors

APM overhead itself impacts application performance — instrumentation adds some overhead; use sampling for high-traffic endpoints rather than tracing every single request if overhead becomes measurable.

Continue Reading

Browse more articles in Performance & Monitoring.

  • apm application performance monitoring, self hosted apm, application metrics monitoring, apm setup guide
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to Install Netdata for Real-Time VPS Monitoring

Netdata provides a real-time, highly detailed web dashboard showing CPU, memory, disk, network,...

How to Set Up Prometheus and Grafana for VPS Monitoring

Prometheus collects and stores time-series metrics, while Grafana visualizes them in customizable...

How to Set Up Uptime Monitoring for Your Website

Uptime monitoring alerts you the moment your website or application goes down — ideally...

How to Set Up Centralized Logging Across Multiple VPS Instances

When running multiple servers, checking logs individually on each one is slow and error-prone...

How to Profile and Optimize Slow Application Requests

When a server has plenty of free CPU and RAM but specific requests are still slow, the bottleneck...