APM — Application Performance Monitoring
TL;DR
APM tools (Datadog, New Relic, Blackfire) automatically instrument applications to profile code-level performance — identifying slow DB queries, N+1 problems, and method-level bottlenecks.
Explanation
APM = auto-instrumentation + profiling + transaction tracing in one product. Unlike OpenTelemetry (code instrumentation), APM agents install at the PHP extension level and instrument automatically. Capabilities: distributed traces, code-level profiling (which PHP function is slow?), DB query analysis (N+1 detection), external service latency, error tracking. PHP APM: Datadog APM (ddtrace extension), New Relic (newrelic extension), Blackfire (profiler, not APM), Elastic APM (PHP agent). SaaS vs self-hosted: Datadog/New Relic are SaaS (expensive), Elastic/Jaeger are self-hosted. APM complements OpenTelemetry — many APMs now export OTLP.
Common Misconception
✗ APM replaces logging and metrics — APM adds profiling and transaction tracing. You still need logs (for content) and metrics (for aggregate trends).
Why It Matters
APM cuts debugging time from hours to minutes for performance issues — seeing exactly which SQL query took 2s is faster than manually adding timing logs.
Common Mistakes
- No APM in production — only monitoring in dev.
- High APM overhead without sampling — some APMs add 5-10% overhead.
- Not configuring APM sampling — 100% trace rate is expensive.
Code Examples
✗ Vulnerable
// Manually timing every operation:
$start = microtime(true);
$result = $pdo->query($sql);
$duration = microtime(true) - $start;
Log::info('Query time', ['ms' => $duration * 1000]);
✓ Fixed
// Datadog APM — auto-instruments PDO:
// Install: composer require datadog/dd-trace-php
// PHP ext: dd-trace.so
// All PDO queries automatically traced with query, duration, error
// Dashboard shows slow queries, N+1 patterns, error traces
// Zero code changes required
Tags
🤝 Adopt this term
£79/year · your link shown here
Added
23 Mar 2026
Edited
5 Apr 2026
Views
26
🤖 AI Guestbook educational data only
|
|
Last 30 days
Agents 0
No pings yet today
No pings yesterday
Perplexity 8
Amazonbot 6
Google 3
Unknown AI 2
Ahrefs 2
ChatGPT 1
Also referenced
How they use it
crawler 20
crawler_json 1
pre-tracking 1
Related categories
⚡
DEV INTEL
Tools & Severity
🟡 Medium
⚙ Fix effort: Medium
⚡ Quick Fix
Install APM agent (Datadog/New Relic extension for PHP). Configure sampling rate. Set up dashboards for slow queries and error traces. Review weekly for N+1 patterns.
📦 Applies To
PHP 7.0+
web
cli
Laravel
Symfony
🔗 Prerequisites
🔍 Detection Hints
Auto-detectable:
✗ No
datadog
newrelic
blackfire
⚠ Related Problems
🤖 AI Agent
Confidence: Low
False Positives: High
✗ Manual fix
Fix: Medium
Context: File