← Home ← Codex ← DEBT
Browse by Category
+ added · updated 7d
← Back to glossary

APM — Application Performance Monitoring

Observability PHP 7.0+ Intermediate
debt(d7/e5/b5/t5)
d7 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'only careful code review or runtime testing' (d7). The absence of APM is not something a compiler or linter catches. The listed tools (Datadog, New Relic, Blackfire) are the APM agents themselves, not detection tools for misuse. Whether APM is misconfigured (e.g., no sampling, not deployed to production) is only discoverable through manual review of infrastructure config or by noticing performance issues in production. detection_hints.automated is 'no'.

e5 Effort Remediation debt — work required to fix once spotted

Closest to 'touches multiple files / significant refactor in one component' (e5). The quick_fix says 'Install APM agent, configure sampling rate, set up dashboards, review weekly for N+1 patterns.' This is not a one-line fix — it involves installing a PHP extension, configuring it across environments, setting up dashboards, and establishing ongoing review processes. It touches deployment config, php.ini/docker configs, and potentially application code for custom instrumentation. Not architectural rework, but a meaningful cross-file operational effort.

b5 Burden Structural debt — long-term weight of choosing wrong

Closest to 'persistent productivity tax' (b5). APM applies to both web and CLI contexts and once installed becomes a persistent operational concern — sampling rates need tuning, dashboards need maintenance, agents need version updates, and the 5-10% overhead (per common_mistakes) must be managed. It's not architecture-defining (b7+) but it does impose an ongoing tax across multiple work streams: deployment, monitoring, performance review cycles.

t5 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'notable trap (a documented gotcha most devs eventually learn)' (t5). The misconception field states 'APM replaces logging and metrics' — this is a well-documented but common trap where developers believe APM is a complete observability solution and neglect logs and metrics. Additionally, common_mistakes include running without sampling (100% trace rate causing expensive overhead) and only using APM in dev but not production. These are traps that competent developers do fall into but eventually learn about.

About DEBT scoring →

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

Added 23 Mar 2026
Edited 5 Apr 2026
Views 58
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
1 ping T 1 ping W 1 ping T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 1 ping T 0 pings F 1 ping S 0 pings S 2 pings M 1 ping T 2 pings W 0 pings T 0 pings F 0 pings S 0 pings S 0 pings M 1 ping T 2 pings W 0 pings T 0 pings F 1 ping S 0 pings S 1 ping M 0 pings T 0 pings W
No pings yet today
No pings yesterday
Perplexity 8 Amazonbot 8 Google 7 ChatGPT 4 Ahrefs 4 Scrapy 4 Unknown AI 2 SEMrush 2 Claude 1 Bing 1 Meta AI 1 PetalBot 1
crawler 39 crawler_json 3 pre-tracking 1
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


✓ schema.org compliant